Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-8036

TestResourceTracker keeps cache managers alive after they are stopped

XMLWordPrintable

      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/:?]
      

              dberinde@redhat.com Dan Berindei (Inactive)
              dberinde@redhat.com Dan Berindei (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: