Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 146341

Summary: Deadlock caused by unnecessary monitor synchronizations
Product: [Modeling] EMF Services Reporter: Christian Damus <give.a.damus>
Component: TransactionAssignee: Christian Damus <give.a.damus>
Status: VERIFIED FIXED QA Contact:
Severity: blocker    
Priority: P1 CC: steveshaw, vramaswa
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 145880    

Description Christian Damus CLA 2006-06-09 17:27:38 EDT
There are two occurrences of unnecessary Java monitor synchronizations in the Transaction API that cause deadlocks:

  - TransactionalEditingDomainImpl.deactivate(InternalTransaction)
    synchronizes on its transactionLock instance.  Within this synch block,
    the post-commit is performed, which creates a read-only transaction and
    invokes listeners.  If any of these listeners does a privileged runnable
    to synchronously execute some code on the Display thread, then deadlock
    occurs because of the next point

  - the Lock.getOwner() and Lock.getDepth() methods are synchronized.  Thus,
    if the UI thread independently invokes some code that tries to get a
    read-only transaction on the editing domain, before it does a non-blocking
    wait for the lock, it calls Lock.getOwner() to see whether it already
    owns the lock.  This method is synchronized, so deadlock occurs because
    another thread has the lock (previous point) and is trying to synchronously
    execute code on the display thread
Comment 1 Christian Damus CLA 2006-06-09 18:28:55 EDT
Committed a fix, removing the synchronizations as indicated.
Comment 2 Steven R. Shaw CLA 2006-06-12 11:50:42 EDT
*** Bug 145880 has been marked as a duplicate of this bug. ***
Comment 3 Nick Boldt CLA 2008-01-28 16:35:23 EST
Move to verified as per bug 206558.