What causes 'Closing a connection for you. Please close them yourself' in JBoss Enterprise Application Platform?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
- 6
- 5
- 4
Issue
-
What is meant by "Closing a connection for you. Please close them yourself"?
... INFO ... IJ000100: Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@<OBJECT_ID_HERE>: java.lang.Throwable: STACKTRACE <ALLOCATION_STACK_TRACE_HERE>- Note that
IJ000100was not included in the error messages in JBoss Enterprise Application Platform (EAP) versions 4.3 nor 5.
- Note that
Resolution
Fix the Java code (see the allocation stack trace) to close connections as illustrated in safely using pooled connections in application code.
Note that the debug facility should not be relied upon as a work around for incorrect application code in production systems. The debug facility is intended for debugging - i.e. identifying the origin of leaks so that they can be corrected. The debug property is expected to be set to false in production systems (for performance reasons, etc.) unless when enabled temporarily for troubleshooting purposes.
Root Cause
- Application or third party code is failing to return connections to the pool after use.
- The cached connection manager has been configured for debug
- For EAP 6/7, see How to enable cached connection manager (CCM)
- For EAP 4.3/5, see How to check which application is using JDBC connections in JBoss EAP 4/5
- When connections are leaked while the
debugproperty is set to true, the Cached Connection Manager will close database connections and log an INFO message with the allocation stack trace for incorrectly managed connections (i.e. those not closed before the end of the application scope in which they were taken from the pool).- Note that forced closure of leaked connections is a side effect of the debug facility and should not be relied upon as a work around for incorrect application code in production systems.
Diagnostic Steps
- Review the server.log
- The INFO events from the Cached Connection Manager will include a stacktrace pointing to the class and line number where the connection was first opened.
- Review the java code for the class found in the "Closing ...Please close..." message from the Cached Connection Manager.
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.