This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 150666 - IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
Summary: IllegalStateException: Should not acquire Children.MUTEX while holding Projec...
Status: VERIFIED FIXED
Alias: None
Product: javame
Classification: Unclassified
Component: Build System (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: _ tboudreau
URL: http://statistics.netbeans.org/except...
Keywords: THREAD
Depends on:
Blocks:
 
Reported: 2008-10-19 22:27 UTC by Lukas Hasik
Modified: 2009-02-19 22:45 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 130518


Attachments
Minimal fix (1.78 KB, patch)
2008-10-20 14:39 UTC, _ tboudreau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Hasik 2008-10-19 22:27:47 UTC
this is possible deadlock please evaluate as P2.

Build: NetBeans IDE Dev (Build 200810171401)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc2-b32
OS: Windows Vista, 6.0, x86
User comments: Right-click on Project Configurations and clicked add new configuration and got this exception
STACKTRACE: (first 10 lines)
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
        at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1793)
        at org.openide.util.Mutex.postRequest(Mutex.java:1245)
        at org.openide.util.Mutex.postRequest(Mutex.java:1209)
        at org.openide.util.Mutex.postWriteRequest(Mutex.java:582)
        at org.openide.nodes.Children$Keys.applyKeys(Children.java:1499)
        at org.openide.nodes.Children$Keys.setKeys(Children.java:1443)
        at
org.netbeans.modules.mobility.project.ui.customizer.NewConfigurationPanel$1.<init>(NewConfigurationPanel.java:109)
        at org.netbeans.modules.mobility.project.ui.customizer.NewConfigurationPanel.<init>(NewConfigurationPanel.java:108)
        at org.netbeans.modules.mobility.project.ui.NodeActions$AddConfigurationAction.addNewConfig(NodeActions.java:651)
        at org.netbeans.modules.mobility.project.ui.NodeActions$AddConfigurationAction.access$100(NodeActions.java:598)
Comment 1 _ tboudreau 2008-10-20 14:39:03 UTC
Created attachment 72268 [details]
Minimal fix
Comment 2 _ tboudreau 2008-10-20 14:44:51 UTC
I've attached a minimal fix to get the call to setKeys() out of the children object's constructor, so that
Children.MUTEX is not acquired.

It does mean the call to 
setKeys(Lookup.getDefault().lookupAll(ProjectConfigurationFactory.class));
will now happen in the event thread.  If this is a performance problem, it's just a few more lines of code to change it
to use Children.create() with asynchronous=true.  

Probably the most minimal fix is preferable if we want to propagate this change into the 6.5 release.
Comment 3 _ tboudreau 2008-10-20 21:36:57 UTC
Ended up fixing this differently than in the attached patch.  We now get project names outside of the write mutex.

106185:6b862af46118
Comment 4 _ tboudreau 2008-10-21 20:25:50 UTC
Raising to P1.  Popup menu item on a node directly under the project causes exception 100% of the time.  Fix is low-risk
- just create the UI before entering ProjectManager.mutex().postWriteAccess().
Comment 5 Petr Suchomel 2008-10-21 21:43:19 UTC
Fix looks to me completely safe
Comment 6 _ tboudreau 2008-10-23 01:25:57 UTC
Committed to release65 repository:
e90094f0d6dc - patch
ecee27412cfd - update of spec version for mobility.project
Comment 7 Andrei Chistiakov 2008-10-23 16:47:01 UTC
Verified with NetBeans IDE 6.5 RC2 (Build 200810231029)