[JDBC-47] Transactions do not rollback on non-Exception Throwables Created: 26/Feb/13 Updated: 01/Jun/16 Resolved: 26/Feb/13
|Reporter:||Gary Fredericks||Assignee:||Sean Corfield|
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:
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 ]|