Reserved connections are not validated by JBoss EAP
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
- 6
- 5
- 4
Issue
- Fault tolerance/connection validation1 has been configured for an EAP datasource pool
- A connection was obtained by calling Content from docs.oracle.com is not included.DataSource.getConnection()
- A failed connection exception is raised when the connection is used
java.sql.SQLRecoverableException: Closed Connectionjava.sql.SQLRecoverableException: No more data to read from socketjava.net.SocketException: Broken pipe- etc.
1
See fault tolerance in EAP 4/5 for older releases
Resolution
- Application code must handle exceptions that arise while a connection is held (
InUse) by the application component - Upon completion of connection usage (even if the connection has failed), the application code must explicitly call Content from docs.oracle.com is not included.Connection.close() to return the connection to the pool in order to prevent a connection leak.
- The application may need to perform other cleanup activity associated with any in-progress work.
- This may include explicit rollback if using bean managed transactions (BMT) or allowing methods to exit if using CMT since in-flight transactions cannot proceed after a connection failure.
- The application would need to retry work (if appropriate) after requesting another connection (and potentially starting a new transaction).
Root Cause
- Fault tolerance/validation configuration only impacts connections which are considered by JBoss to be
Idle.- When a connection is obtained from the pool by calling Content from docs.oracle.com is not included.DataSource.getConnection()) that connection is considered to be
InUseeven if the application code is not executing a method on it - Only when a connection is returned to the pool by explicitly calling Content from docs.oracle.com is not included.Connection.close() is the connection considered by JBoss to be
Idle
- When a connection is obtained from the pool by calling Content from docs.oracle.com is not included.DataSource.getConnection()) that connection is considered to be
InUseconnections cannot be validated by EAP
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.