Red Hat Bugzilla – Bug 996037
Forcing GC in tests causes them to fail on IBM jdk
Last modified: 2013-09-05 11:11:01 EDT
Description of problem:
Tests in HornetQ testsuite fail randomly on ibm jdk when calling forceGC() method in UnitTestCase#tearDown().
Run HQ testsuite on IBM jdk, 1.6 or 1.7
Typical log of failed test:
03:21:55,704 INFO [org.hornetq.core.server] #test testAddHeadAndRemove
03:21:55,709 INFO [org.hornetq.core.server] #test forceGC
03:21:55,837 INFO [org.hornetq.core.server] #test forceGC Done
[repeats many times]
As an example check LinkedListTest in unit tests or RealNodeManager test in integration.
LinkedListTest fails because the list is (unexpectedly) already cleaned when forceGC() is called (the test still expects 999 objects in the list, but gets 0). While this particular test can be fixed by calling any method on the list after assertCount() call in the test (to force the list to still exist at that point), the issue seems to be more general tied calling System.gc(), hence why I'm opening this general bug.
Pull request sent to HQ master:
We really need the force GC in a few tests to validate memory leaks.
Perhaps we should just ignore such tests on IBM and not run them on IBM JDK since that would be irrelevant to validate the platform?
@Clebert I understand the forceGC needs to stay there. After discussion with Mirek, we would go with trying to fix it on test by test basis.
If at all possible I would like to get to the point where the testsuite runs consistently on all supported platforms.
shouldn't we raise issue by test? it's hard to keep track of a generic task like this.
We are not going to remove forceGC. I would rather ignore the test on IBM JDK than removing forceGC
I would raise issues by test.. or just fix by test.. we won't remove forceGC anyways