Bug 1232736

Summary: [GSS](6.4.z) Memory leak in JBoss CLI
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Josef Cacek <jcacek>
Component: CLIAssignee: Tomas Hofman <thofman>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kremensky <pkremens>
Severity: high Docs Contact:
Priority: high    
Version: 6.4.1CC: bmaxwell, brian.stansberry, cdewolf, istudens, jboss-set, lkonno, thofman
Target Milestone: CR1Keywords: Reopened
Target Release: EAP 6.4.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-17 10:43:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1231259    

Description Josef Cacek 2015-06-17 12:04:42 UTC
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

Comment 2 Tomas Hofman 2015-07-08 09:32:20 UTC
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

Comment 4 Petr Kremensky 2015-07-30 11:22:37 UTC
Verified on EAP 6.4.3.CP.CR1

Comment 5 Petr Penicka 2017-01-17 10:40:49 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 6 Petr Penicka 2017-01-17 10:41:26 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Comment 7 Petr Penicka 2017-01-17 10:43:38 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.