Description of problem: The JBoss CLI contains a memory leak related to CLI Kerberos authentication. The org.jboss.as.cli.impl.CommandContextImpl class calls the initJaasConfig() in its constructor, which adds a new JaasConfigurationWrapper instance to javax.security.auth.login.Configuration. It's done for every new CommandContext instance, so it consumes more and more memory. There is no cleanup for the registered configurations. Moreover, the searches for appropriate login config take more and more time because they have to go through all the wrapped objects. How reproducible: always Steps to Reproduce: Simply create new `CommandContextImpl` instances. while (true) { CommandContextFactory.getInstance().newCommandContext(); } Actual results: OutOfMemory error (on my machine somewhere between 16k and 32k instances) Expected results: everything from unused CommandContexts is correctly cleaned up and new instances are created/disposed
I modified CommandContextImpl so that JaasConfigurationWrapper is added only during first instance creation. That removes remaining references to CommandContextImpl instance, allowing it to be garbage collected. I also added demonstrational test case that could be used to verify the leak - note that it's @Ignored so that it doesn't run during build. PR: https://github.com/jbossas/jboss-eap/pull/2475
Verified on EAP 6.4.3.CP.CR1
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.