3 Replies Latest reply on Dec 18, 2015 11:24 AM by raneves

    Memory leak in arquillian


      I've been running into problems with our arquillians tests once we reach about 100+ deployments.   The memory leak is not on the container side:  I've set the   maxTestClassesBeforeRestart  to 1. 

      Using yourkit,  I've determined the DeploymentDescription (which contains the Archive),  hangs around after a test class is finished.


      After some debugging:  DeploymentContextImpl.java.

      There are 2 parent members of importance:   stores and activeStore


      Before a deployment the DeploymentDescription is put into the stores map.   But after deployment that stores map does not get cleared.   It doesn't get cleared until all test classes are finished and by that time it'll contain a DeploymentDescription of every deployed archive for all test classes. 


      There are 2 ways the stores map can be flushed,   via the destroy(T id)  and clearAll().   clearAll isn't called untill all tests/deployments are finished.  and I don't see destroy(T id) being called to destroy the DeploymentDescription.


      (I'm currently using, wildfly 8.1.0,  arquillian 1.1.15, testng 6.8.8)


      I've attached my small project which illustrates the issue.   (you'll need to modify arquillian.xml). 

      1.) Put a breakpoint in AbstractContext.clearAll().

      2.) In eclipse,  Select both tests and "debug as testng"

      3.) when clearAll is called (and the object is a DeploymentContextImpl).   The stores map will contain (after some manual traversal) both DeploymentDescriptions which contain both archives.


      Is this a bug in arquillian or testng-arquillian?

        • 1. Re: Memory leak in arquillian

          I'm seeing the same issue (DeploymentDescription not being freed during JUnit tests), which is leading to test crashes due to memory leaks.

          I am using an older Arquillian 1.0.4, but the root cause is the same.

          Any update available?

          • 2. Re: Memory leak in arquillian

            there was memory leak in arquillian-core when using servlet protocol.

            see https://issues.jboss.org/browse/ARQ-1992


            it was fixed in 1.1.10.Final

            • 3. Re: Memory leak in arquillian

              I'm using this version and getting the error:

              [C3P0PooledConnectionPoolManager-Helper Thread-#0] but has failed to stop it. This is very likely to create a memory leak.


              <!-- Arquiilian/tomcat-embedded-7 Dependencies -->