EJBTimer threads are accumulating memory in org.jboss.security.SecurityAssociation$SubjectContexts
Environment
- JBoss Enterprise Application Platform (EAP)
- 4.3
- 5.x
Issue
- We have a large amount of retention in
org.jboss.security.SecurityAssociation$SubjectContextstracing back to EJBTimer threads
Resolution
- If you have some similar model of cascading thread or scheduled task creation, launch JBoss with
-Dorg.jboss.security.SecurityAssociation.ThreadLocal=trueset. This will cause non-inheritable ThreadLocals to be used instead to prevent continuous growth through inheritance and thread creation.
Root Cause
- New, future EJB timers are created with each EJB timer invocation. The security contexts by default are inherited in children threads so if threads using security contexts continuously create new threads for future work, the contexts keep getting inherited and continuously build.
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.