Derby
  1. Derby
  2. DERBY-5412

MemoryLeakFixesTest.testRepeatedDatabaseCreationWithAutoStats() fails on phoneME: java.lang.InternalError: Number of class names exceeds vm limit.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.8.2.2, 10.9.1.0
    • Fix Version/s: 10.8.2.2, 10.9.1.0
    • Component/s: Test
    • Labels:
      None
    • Bug behavior facts:
      Regression Test Failure

      Description

      Seen when running MemoryLeakFixesTest, both with trunk and with the 10.8.2.1 release candidate:

      1) testRepeatedDatabaseCreationWithAutoStats(org.apache.derbyTesting.functionTests.tests.memory.MemoryLeakFixesTest)java.lang.InternalError: Number of class names
      exceeds vm limit.
      at java.lang.ClassLoader.findLoadedClass0(Native Method)
      at java.lang.ClassLoader.findLoadedClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.util.ResourceBundle.loadBundle(Unknown Source)
      at java.util.ResourceBundle.findBundle(Unknown Source)
      at java.util.ResourceBundle.getBundleImpl(Unknown Source)
      at java.util.ResourceBundle.getBundle(Unknown Source)
      at org.apache.derby.iapi.services.i18n.MessageService.getBundleWithEnDefault(Unknown Source)
      at org.apache.derby.iapi.services.i18n.MessageService.getBundleForLocale(Unknown Source)
      at org.apache.derby.impl.services.monitor.BaseMonitor.getBundle(Unknown Source)
      at org.apache.derby.iapi.services.i18n.MessageService.getBundle(Unknown Source)
      at org.apache.derby.iapi.services.i18n.MessageService.getCompleteMessage(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
      at org.apache.derby.jdbc.Driver169.getNewEmbedConnection(Unknown Source)
      at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
      at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(Unknown Source)
      at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.memory.MemoryLeakFixesTest.testRepeatedDatabaseCreationWithAutoStats(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at sun.misc.CVM.runMain(Unknown Source)

      1. d5412.diff
        5 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Hide
          Knut Anders Hatlen added a comment -

          Thanks for looking at the patch, Dag and Kristian.

          Committed to trunk, revision 1171665.
          Committed to 10.8, revision 1171673.

          Show
          Knut Anders Hatlen added a comment - Thanks for looking at the patch, Dag and Kristian. Committed to trunk, revision 1171665. Committed to 10.8, revision 1171673.
          Hide
          Dag H. Wanvik added a comment -

          +1, nice cleanup with the factoring out of the PhoneME test

          Show
          Dag H. Wanvik added a comment - +1, nice cleanup with the factoring out of the PhoneME test
          Hide
          Kristian Waagan added a comment -

          Looks good to me. +1 to commit.

          Show
          Kristian Waagan added a comment - Looks good to me. +1 to commit.
          Hide
          Knut Anders Hatlen added a comment -

          Attached is a patch which makes the following changes:

          • Adds the helper method isPhoneME() to BaseTestCase and makes existing checks for phoneME use that method.
          • Invokes gc manually on phoneME to work around this problem.
          • Adds an assertion to verify that database shutdown is successful in the test.

          This makes the test succeed in my environment.

          Show
          Knut Anders Hatlen added a comment - Attached is a patch which makes the following changes: Adds the helper method isPhoneME() to BaseTestCase and makes existing checks for phoneME use that method. Invokes gc manually on phoneME to work around this problem. Adds an assertion to verify that database shutdown is successful in the test. This makes the test succeed in my environment.
          Hide
          Knut Anders Hatlen added a comment -

          The experiment with runFinalizerIfNeeded() wasn't very relevant, since the "if needed" part of that method is if there's less than 1/2 MB of free heap space. I also tried running Runtime.runFinalization() unconditionally, but with no luck. However, adding a call to Runtime.gc() each time the test shuts down the database, made the test pass in my environment. So it may look like phoneME doesn't automatically trigger a garbage collection when it's about to exhaust the space for new classes, which would mean it's a phoneME problem and not a Derby bug.

          I'll add manual invocation of gc as a workaround when running on phoneME.

          Show
          Knut Anders Hatlen added a comment - The experiment with runFinalizerIfNeeded() wasn't very relevant, since the "if needed" part of that method is if there's less than 1/2 MB of free heap space. I also tried running Runtime.runFinalization() unconditionally, but with no luck. However, adding a call to Runtime.gc() each time the test shuts down the database, made the test pass in my environment. So it may look like phoneME doesn't automatically trigger a garbage collection when it's about to exhaust the space for new classes, which would mean it's a phoneME problem and not a Derby bug. I'll add manual invocation of gc as a workaround when running on phoneME.
          Hide
          Knut Anders Hatlen added a comment -

          This is with normal heap size (256MB), run individually.

          For the record, I tried adding calls to runFinalizerIfNeeded() at various places in the test case, but that didn't seem to help.

          Show
          Knut Anders Hatlen added a comment - This is with normal heap size (256MB), run individually. For the record, I tried adding calls to runFinalizerIfNeeded() at various places in the test case, but that didn't seem to help.
          Hide
          Kristian Waagan added a comment -

          Does this happen when run with a small heap (i.e. ant junit-lowmem), or when running the test individually with default heap settings?

          Show
          Kristian Waagan added a comment - Does this happen when run with a small heap (i.e. ant junit-lowmem), or when running the test individually with default heap settings?

            People

            • Assignee:
              Knut Anders Hatlen
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development