<< Back to previous view

[JDBC-47] Transactions do not rollback on non-Exception Throwables Created: 26/Feb/13  Updated: 01/Jun/16  Resolved: 26/Feb/13

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

Type: Defect Priority: Major
Reporter: Gary Fredericks Assignee: Sean Corfield
Resolution: Completed Votes: 0
Labels: None


Attachments: Text File JDBC-47-p1.patch    


transaction* currently catches Exceptions for its rollback logic. This means Throwables subclassing java.lang.Error are not caught, and indeed the transaction seems to be immediately committed in this case (at least if the connection has autocommit set to true).

This happened to me in the case of an OutOfMemoryError. Another example is that the following code commits:

  (insert-records "table" {:foo 12})
  (assert false))

Presumably this can be fixed by catching Throwable instead of Exception. I'll prepare a patch to that effect.

Comment by Sean Corfield [ 26/Feb/13 4:48 PM ]

Thanx Gary. In the latest source there may be two pieces of transaction logic so please check for anywhere else that Exception is mentioned!

Comment by Gary Fredericks [ 26/Feb/13 5:17 PM ]

This patch changes Exception to Throwable in two places – transaction* and db-transaction*. The tests pass.

Comment by Sean Corfield [ 26/Feb/13 8:08 PM ]

Patch applied.

Generated at Tue Jan 23 08:33:39 CST 2018 using JIRA 4.4#649-r158309.