Seam application retaining memory in StatefulSessionComponent

Solution Unverified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP) 6
  • JSF 1.2
  • Seam 2.2.x
  • Seam code does not use the 'AutoCreate` annotation.

Issue

  • java.lang.OutOfMemoryError: Java heap space
  • The heap dump shows retention in StatefulSessionComponent. For example:
Problem suspect 1
One instance of "org.jboss.as.ejb3.component.stateful.StatefulSessionComponent" loaded by
"org.jboss.modules.ModuleClassLoader @ 0x98001818" occupies 398,137,272 (27.48%) bytes. The memory is accumulated
in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "<system class loader>".

Resolution

Root Cause

It appears SFSB instances are not being completely/correctly removed by the container.

Diagnostic Steps

  • Analyze a heap dump and verify the retention is caused by one of more instances of org.jboss.as.ejb3.component.stateful.StatefulSessionComponent with the retention in cache (org.jboss.as.ejb3.cache.impl.SimpleCache) backingCache (org.jboss.as.ejb3.cache.impl.backing.NonPassivatingBackingCacheImpl).
  • Rule out bug Content from issues.jboss.org is not included.JBSEAM-4863 by verifying the Seam code does not use the AutoCreate annotation. For example, verify there are no instances of org.jboss.seam.annotations.AutoCreate in the heap dump.
  • Debug logging added to the SFSBs when they are created and destroyed show the SFSBs are properly destroyed by the application.
Components
Category
Tags

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.