-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Peter Szanto opened SPR-10755 and commented
DataSourceTransactionManager
contains a bug when releasing the connection. According to the official recommendation, The problem here is that the code only releases the connection when an exception occurs, not when an Error. In our case when an OutOfMemoryError
occurs we notice that the connections are not released. Here is the code snipped from doBegin()
try {
...
catch (Exception ex) {
DataSourceUtils.releaseConnection(con, this.dataSource);
throw new CannotCreateTransactionException("Could not open JDBC Connection for transaction", ex);
}
The problem is that OOM can be recovered, but not releasing the connections cannot be recovered.
Not sure how much it is related, but when I see abandoned JDBC connections I also see these in the log file :
org.springframework.transaction.TransactionSystemException: Could not roll back JDBC transaction; nested exception is java.sql.SQLException: Connection com.microsoft.sqlserver.jdbc.SQLServerConnection@266290d7 is closed.
Affects: 3.2.3
Issue Links:
- DataSourceTransactionManager closes JDBC connection on doBegin failure but leaves it attached to transaction object [SPR-12280] #16885 DataSourceTransactionManager closes JDBC connection on doBegin failure but leaves it attached to transaction object
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug