<< Back to previous view

[JDBC-54] db-transaction does not close connection? Created: 01/May/13  Updated: 01/Jun/16  Resolved: 07/May/13

Status: Closed
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Critical
Reporter: Sean Corfield Assignee: Sean Corfield
Resolution: Completed Votes: 0
Labels: None


See https://gist.github.com/aphyr/5493964

Comment by Sean Corfield [ 03/May/13 12:39 PM ]

Having reviewed the code, the result of get-connection is never closed, only the result of calling .getConnection on a PreparedStatement and that matches how java.jdbc has always worked, so I don't believe this is a problem. Aphyr mentioned on Twitter that he believes the problem was just due to his test code and not inherent in java.jdbc but we are still waiting for confirmation. Lowering priority for now.

Comment by Sean Corfield [ 07/May/13 8:30 PM ]

I believe I have verified this locally. Under the old API, a connection was only added explicitly at the "top" of a call chain. Under the new API, a connection can be added on-demand in many places which makes the logic much more complex and there are a couple of places where normal usage could indeed cause a connection leak.

Comment by Sean Corfield [ 07/May/13 9:27 PM ]

I believe this is resolved in the latest snapshot (which will become Alpha 4 at some point), as I've gone thru and changed how get-connection is called and ensured that with-open is used whenever a new connection is actually created.

The code needs a fair bit of clean up now tho'. I'm not happy with the result of adding that logic so I need to spend some time refactoring...

Generated at Fri Oct 20 16:28:51 CDT 2017 using JIRA 4.4#649-r158309.