Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.1.1
-
Fix Version/s: 2.1.3
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
BitronixTransaction.fireBeforeCompletionEvent() is not surrounded by a try-catch block to catch RuntimeException so when this happens, the transaction is rolled back and its context isn't cleared (subsequent calls to begin() on the same thread result in an exception stating the nested transactions are not supported).
in BitronixTransaction.commit() there is a line with only a call to fireBeforeCompletionEvent(). Replace it with this:
try { fireBeforeCompletionEvent(); } catch (BitronixSystemException ex) { if (log.isDebugEnabled()) log.debug("SystemException thrown during beforeCompletion cycle causing transaction rollback", ex); rollback(); throw new BitronixRollbackException("SystemException thrown during beforeCompletion cycle caused transaction rollback", ex); } catch (RuntimeException ex) { if (log.isDebugEnabled()) log.debug("RuntimeException thrown during beforeCompletion cycle causing transaction rollback", ex); rollback(); throw new BitronixRollbackException("RuntimeException thrown during beforeCompletion cycle caused transaction rollback", ex); }
Issue Links
- is related to
-
BTM-79
BitronixTransaction swallows any runtime exception thrown during beforeCompletion
-
Activity
Ludovic Orban
made changes -
Ludovic Orban
made changes -
| Description |
BitronixTransaction.fireBeforeCompletionEvent() is not surrounded by a try-catch block to catch RuntimeException so when this happens, the transaction is rolled back and its context isn't cleared (subsequent calls to begin() on the same thread result in an exception stating the nested transactions are not supported).
in BitronixTransaction.commit() there is a line with only a call to fireBeforeCompletionEvent(). Replace it with this: try { fireBeforeCompletionEvent(); } catch (BitronixSystemException ex) { if (log.isDebugEnabled()) log.debug("SystemException thrown during beforeCompletion cycle causing transaction rollback", ex); rollback(); throw new BitronixRollbackException("SystemException thrown during beforeCompletion cycle caused transaction rollback", ex); } catch (RuntimeException ex) { if (log.isDebugEnabled()) log.debug("RuntimeException thrown during beforeCompletion cycle causing transaction rollback", ex); rollback(); throw new BitronixRollbackException("RuntimeException thrown during beforeCompletion cycle caused transaction rollback", ex); } |
BitronixTransaction.fireBeforeCompletionEvent() is not surrounded by a try-catch block to catch RuntimeException so when this happens, the transaction is rolled back and its context isn't cleared (subsequent calls to begin() on the same thread result in an exception stating the nested transactions are not supported).
in BitronixTransaction.commit() there is a line with only a call to fireBeforeCompletionEvent(). Replace it with this: {code} try { fireBeforeCompletionEvent(); } catch (BitronixSystemException ex) { if (log.isDebugEnabled()) log.debug("SystemException thrown during beforeCompletion cycle causing transaction rollback", ex); rollback(); throw new BitronixRollbackException("SystemException thrown during beforeCompletion cycle caused transaction rollback", ex); } catch (RuntimeException ex) { if (log.isDebugEnabled()) log.debug("RuntimeException thrown during beforeCompletion cycle causing transaction rollback", ex); rollback(); throw new BitronixRollbackException("RuntimeException thrown during beforeCompletion cycle caused transaction rollback", ex); } {code} |
Ludovic Orban
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.1.3 [ 18046 ] | |
| Resolution | Fixed [ 1 ] |
Stéphane Nicoll
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |