[arquillian-issues] [JBoss JIRA] (ARQ-2203) Regression: Memory leak in DeploymentContextImpl.stores

Rich DiCroce (Jira) issues at jboss.org
Tue Jan 15 09:07:04 EST 2019


Rich DiCroce created ARQ-2203:
---------------------------------

             Summary: Regression: Memory leak in DeploymentContextImpl.stores
                 Key: ARQ-2203
                 URL: https://issues.jboss.org/browse/ARQ-2203
             Project: Arquillian
          Issue Type: Bug
          Components: core
    Affects Versions: 1.4.0.Final
            Reporter: Rich DiCroce


DeploymentContexts are never destroyed. This creates a memory leak and can lead to OOME due to heap exhaustion.

This was previously reported as ARQ-1949. Comments on that issue indicate it was fixed somewhere between 1.1.7 and 1.1.13. The final comment cites ARQ-1992, but the fix for that issue doesn't appear related to this problem at all. In any case, if this was fixed, it has since regressed. AFAICT there is no code that ever calls DeploymentContext#destroy() anywhere in Arquillian.

For anyone else affected by this issue, there is a workaround. Create a LoadableExtension that properly destroys the deployment after it is no longer needed:
{code}
public class ArquillianLeakFix implements LoadableExtension {

	@Override
	public void register(ExtensionBuilder builder) {
		builder.observer(DeploymentDestroyer.class);
	}
	
	public static class DeploymentDestroyer {
		@Inject
		private Instance<DeploymentContext> deploymentContext;
		
		public void destroyDeployment(@Observes(precedence = Integer.MIN_VALUE) final UnDeployDeployment event) {
			deploymentContext.get().destroy(event.getDeployment());
		}
	}

}
{code}



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the arquillian-issues mailing list