Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1513

"Unreasonable length" exception while starting a server.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.4
    • Fix Version/s: 3.4.6, 3.5.0
    • Component/s: server
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      The server is allowing a client to set data larger than the server can then later read:

      2012-07-18 14:28:12,555 - FATAL [main:QuorumPeer@400] - Unable to load database on disk 
      java.io.IOException: Unreasonable length = 1048583 
      at org.apache.jute.BinaryInputArchive.readBuffer(BinaryInputArchive.java:100) 
      at org.apache.zookeeper.server.persistence.Util.readTxnBytes(Util.java:232) 
      at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.next(FileTxnLog.java:602) 
      at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.init(FileTxnLog.java:529) 
      at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.<init>(FileTxnLog.java:504) 
      at org.apache.zookeeper.server.persistence.FileTxnLog.read(FileTxnLog.java:341) 
      at org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:131) 
      at org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:222) 
      at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:398) 
      at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:143) 
      at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:103) 
      at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76) 
      2012-07-18 14:28:12,555 - FATAL [main:QuorumPeerMain@87] - Unexpected exception, exiting abnormally 
      java.lang.RuntimeException: Unable to run quorum server 
      at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:401) 
      at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:143) 
      at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:103) 
      at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76) 
      Caused by: java.io.IOException: Unreasonable length = 1048583 
      at org.apache.jute.BinaryInputArchive.readBuffer(BinaryInputArchive.java:100) 
      at org.apache.zookeeper.server.persistence.Util.readTxnBytes(Util.java:232) 
      at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.next(FileTxnLog.java:602) 
      at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.init(FileTxnLog.java:529) 
      at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.<init>(FileTxnLog.java:504) 
      at org.apache.zookeeper.server.persistence.FileTxnLog.read(FileTxnLog.java:341) 
      at org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:131) 
      at org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:222) 
      at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:398) 
      ... 3 more
      

      Notice the size is 0x100007 - 7 bytes beyond.

      The SetDataTxn contains the client data + a couple extra fields. On ingest the server is applying the jute.maxbuffer size to the data (expected) but not handling the fact that the data plus these extra fields may exceed the jute.maxbuffer check when reading from disk.

      Workaround was simple here: set the jute.maxbuffer size a bit higher (and fix the mis-behaving client, expectation was not that the data would grow this large).

        Attachments

        1. ZOOKEEPER-1513.patch
          11 kB
          Skye Wanderman-Milne
        2. ZOOKEEPER-1513_2012.10.17.patch
          10 kB
          Skye Wanderman-Milne
        3. ZOOKEEPER-1513_2012.10.17_take2.patch
          10 kB
          Skye Wanderman-Milne
        4. ZOOKEEPER-1513_2012.10.17_take2.tar.gz
          2 kB
          Skye Wanderman-Milne

          Activity

            People

            • Assignee:
              skye Skye Wanderman-Milne
              Reporter:
              phunt Patrick Hunt
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: