JBoss - Java heap retention in WrapperDataSourceService's 'connectionMap' HashMap
Environment
- JBoss Enterprise Application Platform (EAP) 4.3.0_CP07 and earlier
Issue
- We received a "java.lang.OutOfMemoryError: Java heap space"
- The heap is consumed in a RMI TCP Connection thread by org.jboss.resource.adapter.jdbc.local.LocalManagedConnection objects stored in the 'connectionMap' java.util.HashMap of a org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService
Resolution
- This HashMap usage ultimately stems from remote datasource access. Remote access is not recommended due to many performance concerns. The best option would be to remove
from all datasources and access them through the "java:/" context.<use-java-context>false</use-java-context> - Ensure all datasource connections obtained are properly closed
- A bug prevented proper removal from this HashMap with connection closes. Upgrade to 4.3.0_CP08 or later where this bug is fixed and the connections are properly removed from this map.
Root Cause
- The connectionMap.remove isn't properly called to free these connections when they are done being used
Diagnostic Steps
- Troubleshoot with a heap dump as described in Java application "java.lang.OutOfMemoryError: Java heap space" to identify the source of retention
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.