Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347740 - [Workbench] Deadlock in of workbench use of synchronization
Summary: [Workbench] Deadlock in of workbench use of synchronization
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7.2   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 344727
Blocks:
  Show dependency tree
 
Reported: 2011-05-31 03:44 EDT by Prakash Rangaraj CLA
Modified: 2012-01-31 13:50 EST (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prakash Rangaraj CLA 2011-05-31 03:44:32 EDT
+++ This bug was initially created as a clone of Bug #344727 +++


in WorkbenchPlugin.bundleChanged there is a synchronize block on a hashset.  This block is called whenever a change to the state of a bundle is detected.  The listener listening for these change events is a SynchronousBundleListener (see getBundleListener).  The net effect is that while a bundle is being activated (i.e., its state is changing), the workbench's listener is notified and synchronizes on the hashset.

It seems that through a quirk of classloading or something, hitting the event.getType() line in bundleChanged() can trigger some classloading.  I'm not sure exactly what but the thread that has the lock on the hashset blocks trying to get a lock on the classloader.  If some other thread has the classloader lock and is trying to change the state of a bundle (thus resulting in a bundleChanged() call) then we get deadlock.

Indeed that is what is happening in a case where the PDE Build application is being run using an Eclipse IDE install.  See bug 344030.

While this may highlight a particular problem with the JVM or Equinox, it would help if we could do one or more of the following:

- change the bundle listener to be Asynchronous (not sure I fully understand what the listener is doing or how this would affect that)

- move the event.getType() call outside the synchronized block.  We are testing this change to see if it helps.
Comment 1 Paul Webster CLA 2012-01-04 11:42:41 EST
Eric, if this needs to be fixed in 3.7.2 it needs to be done this week.

PW
Comment 2 Eric Moffatt CLA 2012-01-04 14:01:57 EST
Pushed to R3_7_maintenance in >20120104.

commit 4c27cc46f9c8ea6f085ed04dbbfab3358d592086
Comment 3 Oleg Besedin CLA 2012-01-31 13:50:32 EST
Verified the updated code is present in M20120127-0800.