-
Bug
-
Resolution: Done
-
Major
-
9.1.0.Final, 9.0.3.Final
TestCacheManagerFactory.newDefaultCacheManager() adds the manager to TestResourceTracker so if the test doesn't stop it explicitly, TestResourceTracker will.
When a test uses @CleanupAfterMethod, however, the cache managers are stopped and recreated after each method, but the list of resources is only cleared at the end of the test class. If a test has lots of methods, like LocalDistributedExecutorTest and its subclasses, the stopped managers can use a lot of memory (250KB for each ComponentMetadataRepo).
I believe the extra memory usage is causing longer GC pauses, and in turn leads to intermittent test failures in test methods that use short timeouts:
16:58:34,801 ERROR (testng-ReplSyncDistributedExecutorTest:[]) [TestSuiteProgress] Test failed: org.infinispan.distexec.ReplSyncDistributedExecutorTest.testInvokeAnyTimedSleepingTasks java.lang.AssertionError: Should have thrown an class java.util.concurrent.TimeoutException at org.infinispan.test.Exceptions.assertException(Exceptions.java:21) ~[test-classes/:?] at org.infinispan.test.Exceptions.expectException(Exceptions.java:92) ~[test-classes/:?] at org.infinispan.distexec.LocalDistributedExecutorTest.testInvokeAnyTimedSleepingTasks(LocalDistributedExecutorTest.java:269) ~[test-classes/:?]
- causes
-
JDG-1057 TestResourceTracker keeps cache managers alive
- Closed