|
Kathey Marsden made changes - 11/Jan/08 03:27 PM
[
Permlink
| « Hide
]
Kathey Marsden added a comment - 11/Jan/08 09:07 PM
The leak appears to be in SectionManager.positionedUpdateCursorNameToQuerySection_ which contrary to its name holds cursor mapping for all cursors, not just positioned updates. These are not getting cleaned up in finalization.
Kathey Marsden made changes - 14/Jan/08 07:32 PM
The leak was actually in SectionManager.positionedUpdateCursorNameToResultSet_ which kept a reference to the ResultSet so it wouldn't get garbage collected. The solution was to use a WeakReference to the ResultSets in positionedUpdateCursorNameToResultSet_ so that they can be garbage collected. See C:\kmarsden\patches\derby-3316_diff.txt . Running tests now.
Kathey Marsden made changes - 14/Jan/08 08:56 PM
There may be a problem with the patch, My suites.All run ran out of memory.
Doesn't the Hashtable still leak with the patch? It allows the ResultSet objects to be freed, but the Hashtable doesn't remove the empty WeakReference objects, so it will still grow, I think.
It seems like you planned to add a comment to mapCursorNameToResultSet() but forgot to finish it. Thank you Knut for looking at the patch. I verified that the entries get removed from the Hashtable as part of the markClosed processing. I printed out the size after calls to removeCursorNameToResultSetMapping and verified that the Hashtable is not growing. I fixed up the comment in the revised patch derby-3316_diff2.txt
Kathey Marsden made changes - 15/Jan/08 04:42 PM
Seems like that the Hashtable positionedUpdateCursorNameToResultSet should really be a java.util.WeakHashMap, this would simplify the code, not exposing WeakReference into get/puts.
Actually making it a WeakHashMap is what I tried first but a WeakHashMap only creates WeakReferences based on the keys not the values, so that did not work. See the implementation notes at: http://java.sun.com/javase/6/docs/api/java/util/WeakHashMap.html
Ignore that, I don't think a WeakHashMap is suitable, as it puts the WeakReference on the key.
> I verified that the entries get removed from the Hashtable as part of the markClosed processing.
Thanks Kathey, that makes sense. +1 to commit.
Kathey Marsden made changes - 15/Jan/08 11:47 PM
r612262 | kmarsden | 2008-01-15 23:36:38 +0100 (Tue, 15 Jan 2008) | 5 lines
Could this commit have made org.apache.derbyTesting.functionTests.tests.jdbcapi.JDBCHarnessJavaTest fail: From suites all: There was 1 failure: 1) derbyStress(org.apache.derbyTesting.functionTests.tests.jdbcapi.JDBCHarnessJa vaTest)junit.framework.ComparisonFailure: Output at line 6 expected:<Test derbyS tress finished.> but was:<FAIL -- unexpected exception ****************> at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon (CanonTestCase.java:100) at org.apache.derbyTesting.functionTests.util.HarnessJavaTest.runTest(Ha rnessJavaTest.java:91) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java: 96) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57 ) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57 ) org.apache.derbyTesting.functionTests.tests.jdbcapi.JDBCHarnessJavaTest is passing for me and I don't see a failure in the tinderbox. What is the output that you see for the test? Perhaps I can glean something from that.
That said I wonder if derbyStress should be run as part of JDBCHarnessJavaTest since it is supposed to run with -Xmx64M. It seems instead that it should remain in derbyall, since we can't control the heap for JUnit tests. Thoughts? Hi Kathey,
I reran the tests without getting this error - seems like an intermittent test failure. Sorry for the noise. Attached is a patch to move derbyStress back to derbyall so that we can run it with 64MB heap. I will run tests tonight and commit tomorrow.
Kathey Marsden made changes - 17/Jan/08 04:41 PM
An alternative is to add a target under ant that runs the junit test with 64mb rather than reverting back to the harness, which we are trying to get rid of.
Then it could become part of the ant junit-all target that runs all the junit tests (which is actually more that suites.All). For the adding it to the junit-all target option I think a few things have to happen for it to be run as part of the nightlies.
1) Convert derbyStress.java to junit. 2) create a junit-lomem target and make it part of junit-all. 3) Fix junit-all so that it can run with the nightlies. DERBY-2045 + distribute ant to the testing machines make nightly script changes etc. I don't have time right now to pursue all of these, so am proposing we move derbyStress.java back to derbyall for now until these goals can be accomplished so at least the nightlies are testing the low memory scenarios. Right now the test doesn't test much because it won't fail even if there is a leak. I think it was moved to JDBCHarnessJavaTest prematurely. I'd like to move it back to derbyall and open an issue to covert derbyStress outlining the issues. Does that sound ok?
Ole Solberg made changes - 18/Jan/08 10:37 AM
Fine to move the test back, I'd assumed it had been converted to Junit.
Dag H. Wanvik made changes - 30/Jun/09 03:55 PM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||