<< Back to previous view

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

Status: Resolved
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


 Description   

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



 Comments   
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 Thu Nov 27 23:49:45 CST 2014 using JIRA 4.4#649-r158309.