Bug 412 : Connections not propertly closed in case of SQLExceptions
Priority 
High
Reported Version 
 
Logged By 
Remo
Status 
Fixed
Fixed Version 
2.8.1
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
11/07/2012
Updated 
11/07/2012
Type 
Bug
 
Attachments 
No attachments

e.g. TranscationManager:

public SpiTransaction createTransaction(boolean explicit, int isolationLevel) {
try{
...
Connection c = dataSource.getConnection();
...
t.setBatchMode(true);
...
c.setTransactionIsolation(isolationLevel);
return t;
}catch (SQLException ex) {
throw new PersistenceException(ex);
}
}

If setBatchMode() or setTranscationIsolation() fails, the connection is lost. It should be closed in the catch clause. Otherwise, at some point in the future, there are too many open connections or the connection pool run out of available connections.

There might other places in the source code where the same problem occurs. All connection allocations have to be checked.

 
Rob 29 Jul 08:39
Fixed in HEAD

fixed in HEAD.

woResponse

Upload a file