Large java heap growth in EJB3 SimpleCache expirationFutures

Solution Unverified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP) 7.2.x

Issue

  • We see heap usage grow with many java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTasks. These are all stored in org.jboss.as.ejb3.cache.simple.SimpleCache's expirationFutures map. Inspecting the tasks show they are all in a cancelled state. Why are these cancelled tasks not removed?

Resolution

  • Upgrade to 7.2.9+
  • Address any repeating exceptions during EJB invocations

Root Cause

  • Stateful EJB session timeouts are managed by scheduled tasks. When an EJB instance is fetched from cache, its current expiration task is cancelled so it can be replaced later witha new expiration task. Currently, the expiration tasks are not removed from cache upon the cache get() calls. It is then up to the cache's release() call to overwrite the cancelled task with a new one. It seems with an exception, the release() will not occur so the cancelled task entry does not get removed from cache in all scenarios.
  • This content is not included.JBEAP-19541
  • This content is not included.JBEAP-19544
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.