Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325002 - ConcurrencyException if defered constraints cause an exception and commit is called after writeChanges
Summary: ConcurrencyException if defered constraints cause an exception and commit is ...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 324454 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-10 14:37 EDT by Chris Delahunt CLA
Modified: 2022-06-09 10:28 EDT (History)
1 user (show)

See Also:


Attachments
proposed fix and a test case (5.71 KB, patch)
2010-09-10 14:37 EDT, Chris Delahunt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Delahunt CLA 2010-09-10 14:37:30 EDT
Created attachment 178644 [details]
proposed fix and a test case

If calling 
uow.writeChanges();
uow.commit();
with code that will cause a constraint violation and using defered constraints, the exception will be thrown when the transaction commits, during the uow.commit() call.  Instead of getting the underlying constraint violation exception from the database, a ConcurrencyException 
"Exception Description: A signal was attempted before wait() on 
ConcurrencyManager. This normally means that an attempt was made to 
commit or rollback a transaction before it was started, or to rollback a 
transaction twice. " is thrown.  In addition, the unitOfWork is left in the CommitTransactionPending state, so that a uow.release() will also result in the same ConcurrencyException.  


This situation only occurs if writeChanges is used, and only on a UnitOfWorkImpl (not the new RepeatableWriteUnitOfWork, as the state isn't changed to CommitTransactionPending).  Problem is that commitTransactionAfterWriteChanges calls rollbackTransaction() before calling release() when an exception occurs.  rollbackTransaction will mark the transaction for rollback, causing the ConcurrencyException when release is called because the state is still in CommitTransactionPending.
Comment 1 Chris Delahunt CLA 2010-09-14 15:24:59 EDT
fix checked into trunk (2.2) at revision 8183
Comment 2 Chris Delahunt CLA 2010-09-20 11:06:45 EDT
*** Bug 324454 has been marked as a duplicate of this bug. ***
Comment 3 Chris Delahunt CLA 2010-09-20 13:27:40 EDT
fix checked into 2.1.2 in revision 8218
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:28:26 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink