Why does the JndiLoginInitialContextFactory leak instances of SecurityAssociation$SubjectContext in JBoss?
Issue
- During a profiling of our application we see the object count of SecurityAssociation$SubjectContext continually increasing over time.
-
We instantiate a new InitialContext (JndiLoginInitialContextFactory) with authentication information, then close it and this operation leaks SecurityAssociation$SubjectContext.
public void onMessage(Message msg) { try { Properties env = new Properties(); env.setProperty(Context.SECURITY_PRINCIPAL, "admin"); env.setProperty(Context.SECURITY_CREDENTIALS, "admin"); env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory"); InitialContext ic = new InitialContext(env); ic.close(); } catch (Exception e) { System.out.println(e.getMessage()); } }
Environment
- JBoss Enterprise Application Platform (EAP)
- 4.2.x
- 4.3.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.