5 Replies Latest reply: Mar 19, 2007 8:55 AM by Greybird-Oracle RSS

    RunRecoveryException: BufferOverflowException on startup

    552025
      Hi all.

      I get the above when constructing the XAEnvironment if the application was kill -9'd between a prepare() and a sync().

      prepare(), sync() and prepare(), commit(), sync() work.
      prepare() and prepare(), commit() do not.

      The problem occurs with both 3.1.0 and 3.2.13.
      I tried to setSync(true) the TransactionConfig, with no effect.

      My environment config is:

      envConfig.setAllowCreate( true );
      envConfig.setTransactional( true );
      envConfig.setCachePercent(60);
      envConfig.setTxnTimeout(0);

      Full stack trace:

      Problem seen while tracing into the database log:
      com.sleepycat.je.RunRecoveryException: java.nio.BufferOverflowException
      at com.sleepycat.je.log.LogManager.log(LogManager.java:284)
      at com.sleepycat.je.log.LogManager.log(LogManager.java:181)
      at com.sleepycat.je.log.TraceLogHandler.publish(TraceLogHandler.java:41)
      at java.util.logging.Logger.log(Logger.java:428)
      at java.util.logging.Logger.doLog(Logger.java:450)
      at java.util.logging.Logger.log(Logger.java:473)
      at com.sleepycat.je.utilint.Tracer.trace(Tracer.java:71)
      at com.sleepycat.je.recovery.RecoveryManager.undoLNs(RecoveryManager.java:995)
      at com.sleepycat.je.recovery.RecoveryManager.buildTree(RecoveryManager.java:428)
      at com.sleepycat.je.recovery.RecoveryManager.recover(RecoveryManager.java:153)
      at com.sleepycat.je.dbi.EnvironmentImpl.<init>(EnvironmentImpl.java:338)
      at com.sleepycat.je.dbi.DbEnvPool.getEnvironment(DbEnvPool.java:101)
      at com.sleepycat.je.dbi.DbEnvPool.getEnvironment(DbEnvPool.java:53)
      at com.sleepycat.je.Environment.<init>(Environment.java:100)
      at com.sleepycat.je.XAEnvironment.<init>(XAEnvironment.java:35)
      at com.arantech.bdb.RestartTest.Main.main(Main.java:45)
      Caused by: java.nio.BufferOverflowException
      at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:165)
      at java.nio.ByteBuffer.put(ByteBuffer.java:812)
      at com.sleepycat.je.log.LogUtils.writeByteArray(LogUtils.java:189)
      at com.sleepycat.je.log.LogUtils.writeString(LogUtils.java:221)
      at com.sleepycat.je.utilint.Tracer.writeToLog(Tracer.java:186)
      at com.sleepycat.je.log.LogManager.marshallIntoBuffer(LogManager.java:541)
      at com.sleepycat.je.log.LogManager.log(LogManager.java:260)
      ... 15 more
        • 1. Re: RunRecoveryException: BufferOverflowException on startup
          Charles Lamb
          Hello user549022,

          Thanks for sending this along. I've opened an internal SR for this [15293] so I'd like to take this offline. If you are able to send me your RestartTest so that I can run this myself, that would be great. Please email me at charles.lamb @ where you would expect.com.

          Thanks very much.

          Charles Lamb
          • 2. Re: RunRecoveryException: BufferOverflowException on startup
            552025
            Whoops.. sorry.. forgot the end.

            I was wondering what I was doing wrong and - if not - what I could do about it?

            I have a small test program available to anyone interested.

            Cheers,

            Matthieu
            • 3. Re: RunRecoveryException: BufferOverflowException on startup
              Charles Lamb
              Hi Matthieu,

              This is SR 15293 in our internal system. Thank you for locating the problem. For anyone interested, it turns out that Matthieu uses foreign encoding in his XidImpl class. During recovery, we log an informational message if we find an orphaned prepare record from a 2PC. The log message does an Xid.toString() but does not account correctly for the difference between String.length() and String.getBytes().length when non 8-bit encodings are used (our bug, not his).

              JE release 3.2.15 or later fixes this. If anyone needs a fix for this bug, please let me know and I can email it to you. I'll post the diffs here on this forum -- they're very simple.

              Regards,

              Charles Lamb
              • 4. Re: RunRecoveryException: BufferOverflowException on startup
                Charles Lamb
                Here are the diffs:
                Index: src/com/sleepycat/je/log/LogUtils.java
                ===================================================================
                RCS file: /a/CVSROOT/je/src/com/sleepycat/je/log/LogUtils.java,v
                retrieving revision 1.49
                diff -w -c -r1.49 LogUtils.java
                *** src/com/sleepycat/je/log/LogUtils.java     30 Oct 2006 21:14:20 -0000     1.49
                --- src/com/sleepycat/je/log/LogUtils.java     16 Dec 2006 17:42:01 -0000
                ***************
                *** 232,238 ****
                       * @return log storage size for a string
                       */
                      public static int getStringLogSize(String s) {
                !         return INT_BYTES + s.length();
                      }
                 
                      /**
                --- 241,247 ----
                       * @return log storage size for a string
                       */
                      public static int getStringLogSize(String s) {
                !         return INT_BYTES + s.getBytes().length;
                      }
                 
                      /**
                • 5. Re: RunRecoveryException: BufferOverflowException on startup
                  Greybird-Oracle
                  Hello all,

                  For the record, the fix for this problem is included in JE 3.2.21:

                  Berkeley DB Java Edition 3.2.21 is now available

                  Mark