6 Replies Latest reply on Mar 19, 2007 1:58 PM by Greybird-Oracle

    bug report: NullPointerException on shutdown, v3.2.13

      Hi all,

      When running BDB-JavaEdition v3.2.13 with Sun Jdk 1.6.0, if trace is enabled at finest level, when the environment closes, the following exception occurs:
      FINE: Env . daemons shutdown
      Exception in thread "main" java.lang.NullPointerException
           at com.sleepycat.je.log.LogManager.log(LogManager.java:311)
           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:472)
           at java.util.logging.Logger.doLog(Logger.java:494)
           at java.util.logging.Logger.log(Logger.java:517)
           at com.sleepycat.je.utilint.Tracer.trace(Tracer.java:71)
           at com.sleepycat.je.dbi.EnvironmentImpl.doClose(EnvironmentImpl.java:967)
           at com.sleepycat.je.dbi.EnvironmentImpl.close(EnvironmentImpl.java:895)
           at com.sleepycat.je.Environment.close(Environment.java:319)
      This happens because in com.sleepycat.je.dbi.EnvironmentImpl, the call shutdownDaemons() - line 960 will close the checkpointer and the call Tracer.trace(Level.FINE, this,...) - line 967 will try to use a null checkpointer.

        • 1. Re: bug report: NullPointerException on shutdown, v3.2.13
          Charles Lamb
          Hi Mircea,

          It's funny that you should report this -- I just ran into this the other day and it is fixed in our mainline sources. Do you need a workaround for this? If so, I'll post the diffs. The workaround is to just remove that trace call in doClose() and recompile JE.


          Charles Lamb
          • 2. Re: bug report: NullPointerException on shutdown, v3.2.13
            Hi Charles,

            Just wanted to let you know about this for the upcoming releases. The workaround is straightforward :)

            • 3. Re: bug report: NullPointerException on shutdown, v3.2.13

              I observe this with loggin level set to java.util.logging.Level.FINER. Could you tell me if the fix is available in any of the latest builds?

              • 4. Re: bug report: NullPointerException on shutdown, v3.2.13
                Linda Lee-Oracle

                The fix is checked into the next patch release, but not in any public release yet. In the meantime, here's a diff which shows how we moved the tracing call to the point before we shut down the daemon threads. You could edit your src/com/sleepycat/je/dbi/EnvironmentImpl.java file and recompile the library with "ant jar".
                $ cvs diff -wc src/com/sleepycat/je/dbi/EnvironmentImpl.java
                Index: src/com/sleepycat/je/dbi/EnvironmentImpl.java
                RCS file: /a/CVSROOT/je/src/com/sleepycat/je/dbi/EnvironmentImpl.java,v
                retrieving revision 1.255
                diff -w -c -r1.255 EnvironmentImpl.java
                *** src/com/sleepycat/je/dbi/EnvironmentImpl.java       4 Dec 2006 18:47:41 -000
                0       1.255
                --- src/com/sleepycat/je/dbi/EnvironmentImpl.java       14 Mar 2007 02:51:33 -00
                *** 956,961 ****
                --- 956,964 ----

                +             /* Flush log. */
                +             Tracer.trace(Level.FINE, this,
                +                          "About to shutdown daemons for Env " + envHome);
                            try {
                            } catch (InterruptedException IE) {
                *** 963,971 ****

                -             /* Flush log. */
                -             Tracer.trace(Level.FINE, this,
                -                          "Env " + envHome + " daemons shutdown");
                            try {
                            } catch (DatabaseException DBE) {
                --- 966,971 ----
                • 6. Re: bug report: NullPointerException on shutdown, v3.2.13
                  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