jBPM memory leak in SOA-P 4.3 CP01 or EAP with jBPM caused by classloaders

Solution Verified - Updated -

Environment

  • JBoss Enterprise SOA Platform (SOA-P) 4.3 CP01
  • JBoss Enterprise Application Platform (EAP) 4.3 using jBPM 3.2.5sp5

Issue

  • We are using jBPM in SOA-P 4.3 CP01. We have changed the 2nd level cache to JBoss Cache, but we are still having memory issues when we let the server run for a couple of days
    • We have taken some heap dumps, which show jBPM related classes as those taking up the majority of the memory. It looks like the servers leak about 100 MB a day, which means that they can run at most ~10 days before needing a restart.
  • A heap dump shows org.jboss.serial.classmetamodel.ClassMetamodelFactory is using a large amount of memory
    • The memory is in a PartitionedWeakMap, with classloaders as the key.

Resolution

  • Upgrade to SOA-P 4.3 CP02 which contains jBPM 3.2.7 where JBPM-2202 is fixed.
  • Use jBPM 3.2.8_SOA instead of 3.2.5sp5 with EAP (requires SOA-P subscriptions)

Root Cause

This is addressed in JBPM-2202 [1], which is fixed in jBPM 3.2.7, SOA-P 4.3 CP02:
SharedProcessClassLoaderFactory prevents process classes from being
loaded each time a process instance executes a delegation.

The memory used by process classes is not actually leaked since a full
GC will reclaim it. However, the memory will be unavailable to
applications in the time between collects.

SharedProcessClassLoaderFactory also makes static variables in process
classes useful again, and should even improve performance a bit due to
less frequent class initialization. For these reasons
SharedProcessClassLoaderFactory is present in the default configuration.

[1] https://jira.jboss.org/jira/browse/JBPM-2202

Diagnostic Steps

  • Inspect heap dumps.
  • Is the memory being kept alive because there are many classloaders, with jBPM proxies?

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.

Comments