RuntimeException during releaseStatements causes JDBC connection not to be closed

Description

We have seen exceptions in production related to some misconfiguration of our Infinispan / JGroups clustering. Another story. What happened was an SQLException is thrown when Hibernate tried to release a ResultSet, this resulted in a RuntimeException (as the SQLException is rethrown as an UndeclaredThrowableException) and misses the connection.close() which leaves hanging connections and eventually connection starvation.

What do you think about putting the connection.close() in JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:190) into a finally block?

Here is the exception stacktrace that we are seeing that is causing this issue:

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Karl von Randow

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure