Bug 150540 - IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
IllegalStateException: Should not acquire Children.MUTEX while holding Projec...
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Project
6.x
PC All
: P2 (vote)
: 6.x
Assigned To: Tomas Zezula
issues@java
http://statistics.netbeans.org/except...
EXCEPTIONS_REPORT
:
: 158771 162647 162674 (view as bug list)
Depends on: 148066 172802 191295
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-17 14:07 UTC by Petr Cyhelsky
Modified: 2010-10-27 13:04 UTC (History)
22 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (8.38 KB, text/plain)
2008-12-20 00:41 UTC, Lukas Jungmann
Details
stacktrace (6.76 KB, text/plain)
2009-03-31 14:54 UTC, Marian Mirilovic
Details
stacktrace (7.88 KB, text/plain)
2009-04-01 00:59 UTC, spaquet
Details
stacktrace (7.88 KB, text/plain)
2009-04-01 01:07 UTC, spaquet
Details
stacktrace (8.81 KB, text/plain)
2009-11-02 14:22 UTC, Martin Entlicher
Details
stacktrace (6.76 KB, text/plain)
2010-03-24 08:39 UTC, J Bachorik
Details
stacktrace (8.26 KB, text/plain)
2010-04-19 07:14 UTC, Alexandr Scherbatiy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Cyhelsky 2008-10-17 14:07:49 UTC
Build: NetBeans IDE Dev (Build 081007)
VM: Java HotSpot(TM) Client VM, 1.5.0_15-b04, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_15-b04
OS: Windows Vista, 6.0, x86
User comments: I got it when i tried to access properties of java SE project, other reporters got it when closing
project properties

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:1798)
        at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1320)
        at org.openide.util.Mutex.readAccess(Mutex.java:275)
        at org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.<init>(TreeView.java:2016)
        at org.openide.explorer.view.TreeView$ExplorerTree.paint(TreeView.java:1663)
        at javax.swing.JComponent.paintChildren(JComponent.java:843)
        at javax.swing.JComponent.paint(JComponent.java:1015)
        at javax.swing.JViewport.paint(JViewport.java:728)
        at javax.swing.JComponent.paintChildren(JComponent.java:843)
        at javax.swing.JComponent.paint(JComponent.java:1015)
Comment 1 Tomas Zezula 2008-10-23 15:43:48 UTC
The Mutex is taken in the projectui which calls j2seproject.
Comment 2 aldobrucale 2008-11-06 14:36:13 UTC
It happens regularly adding library to the run classpath of a j2se project
Comment 3 Milan Kubec 2008-11-06 14:39:40 UTC
There is not data loss I guess.
Comment 4 Petr Cyhelsky 2008-11-12 08:31:19 UTC
For me there was no data loss, but i can't speak for others.
Comment 5 Exceptions Reporter 2008-12-08 12:36:17 UTC
This issue has already 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=144990
Comment 6 Lukas Jungmann 2008-12-20 00:40:56 UTC
Build: NetBeans IDE Dev (Build 20081219090959)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Linux, 2.6.27-10-generic, i386

User Comments: 
trying to update library and run args for a (locally modified) project (http://hg.netbeans.org/nb-quality/file/e27f6fff8b6c/tools/nblocCounter/) in project properties

(and now loosing all unsaved changes since I'm not able to find any way to "close" build-impl was modified externaly dialog because this ex. is still poping up whatever I do ...)

Stacktrace: 
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
        at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1799)
        at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1320)
        at org.openide.util.Mutex.readAccess(Mutex.java:275)
        at org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.<init>(TreeView.java:2029)
        at org.openide.explorer.view.TreeView$ExplorerTree.paint(TreeView.java:1676)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
Comment 7 Lukas Jungmann 2008-12-20 00:41:02 UTC
Created attachment 75202 [details]
stacktrace
Comment 8 mslama 2009-03-16 13:58:48 UTC

*** This issue has been marked as a duplicate of 148066 ***
Comment 9 Jesse Glick 2009-03-16 15:40:01 UTC
J2SEProjectProperties.showModifiedMessage is at fault. As I have said before, this dialog should be rewritten. It should
_not_ block project saving asking whether to regenerate build-impl.xml. This file should _always_ be regenerated; if it
was modified, save a backup copy and the notify the user of this fact later.
Comment 10 mslama 2009-03-16 16:06:04 UTC
This is another issue. It can be changed but it does not fix problem introduced by fix of issue #148066: It effectively
blocks opening any modal dialog under PM.mutex(). Is it correct or not?
Comment 11 David Strupl 2009-03-17 15:19:40 UTC
*** Issue 158771 has been marked as a duplicate of this issue. ***
Comment 12 David Strupl 2009-03-17 15:23:26 UTC
IMHO the problem is in these lines:

        at org.netbeans.modules.project.uiapi.CustomizerDialog$OptionListener$1.run(CustomizerDialog.java:213)
        at org.openide.util.Mutex.writeAccess(Mutex.java:394)
        at org.netbeans.modules.project.uiapi.CustomizerDialog$OptionListener.actionPerformed(CustomizerDialog.java:211)

Holding the mutex and calling outside - whatever you do might eventually end up trying to acquire the other mutex...
Please check also the #158771.
Comment 13 mslama 2009-03-18 14:41:53 UTC
Root cause is too restrictive check for 'possible' deadlock condition introduced by issue #148066 as I said above.
Current usage of ProjectManager.mutex().writeAccess() on pressing OK button is to make sure no one else is
writing/reading data at the same time. Every 3rd party customizear panel is expected to save its data and #148066 blocks
any modal dialog to be used under ProjectManager.mutex().writeAccess(). Sorry there is nothing we can do with it.
Jesse's suggestion is just workaround to this restriction but it does not solve root cause.
Comment 14 Andrei Badea 2009-03-18 16:40:42 UTC
Issue 148066 does not check for deadlock conditions. It simply ensures correct lock ordering. Acquiring Children.MUTEX
while holding ProjectManager.mutex() is illegal. No code is allowed to do that, because other code is allowed to acquire
PM.mutex() while holding Children.MUTEX. So the check in issue 148066 is not too restrictive. It simply enforces an
invariant. Any code that leads to Children.MUTEX being acquired under PM.mutex() is breaking that invariant and needs to
be fixed.

As for this issue, you are right that customizer panels are expected to save the data in the AWT thread under
PM.mutex(). Issue 148066 does not prevent you from doing that. You simply need to make sure that you don't display
dialogs under PM.mutex(), since that causes redraws elsewhere and the redraws might acquire Children.MUTEX.
Comment 15 mslama 2009-03-18 18:48:55 UTC
Ok. Then we will follow Jesse's suggestion: java/project code should not display any dialog 'synchronously'. It should
just save file and eventually make backup first if it was modified by user and show info dialog about it asynchronously
(using invokeLater).

If there will be need to display synchronous dialog it must be done in some PRE_OK action without PM.mutex. (But it
would require API change if I am not wrong.)
Comment 16 Marian Mirilovic 2009-03-31 14:54:03 UTC
Build: NetBeans IDE Dev (Build 200903310200)
VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Linux, 2.6.27-11-generic, amd64

User Comments: 


Stacktrace: 
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
        at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1805)
        at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1320)
        at org.openide.util.Mutex.readAccess(Mutex.java:275)
        at org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.<init>(TreeView.java:2086)
        at org.openide.explorer.view.TreeView$ExplorerTree.processFocusEvent(TreeView.java:1847)
        at java.awt.Component.processEvent(Component.java:5972)
Comment 17 Marian Mirilovic 2009-03-31 14:54:08 UTC
Created attachment 79142 [details]
stacktrace
Comment 18 spaquet 2009-04-01 00:59:24 UTC
Build: NetBeans IDE Dev (Build 200903250219)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.6, i386

User Comments: 
Changing from project platform.
This project was modified on an other machine with JDK 1.6 soylate, which is not installed on the current machine where JDK 1.6 from apple lies.
So I decided to move to JDK 1.6 and got this error

Stacktrace: 
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
        at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1805)
        at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1320)
        at org.openide.util.Mutex.readAccess(Mutex.java:275)
        at org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.<init>(TreeView.java:2086)
        at org.openide.explorer.view.TreeView$ExplorerTree.paint(TreeView.java:1794)
        at javax.swing.JComponent.paintChildren(JComponent.java:843)
Comment 19 spaquet 2009-04-01 00:59:30 UTC
Created attachment 79187 [details]
stacktrace
Comment 20 spaquet 2009-04-01 01:07:28 UTC
Build: NetBeans IDE Dev (Build 200903250219)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.6, i386

User Comments: 
Same as already described : moving to JDK 1.6 from appel
For information: project was created on an other machine. The 2 JDK were not on the same PC. This occured when movong the project from one machine to an other where change took place.


Stacktrace: 
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
        at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1805)
        at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1320)
        at org.openide.util.Mutex.readAccess(Mutex.java:275)
        at org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.<init>(TreeView.java:2086)
        at org.openide.explorer.view.TreeView$ExplorerTree.paint(TreeView.java:1794)
        at javax.swing.JComponent.paintChildren(JComponent.java:843)
Comment 21 spaquet 2009-04-01 01:07:37 UTC
Created attachment 79190 [details]
stacktrace
Comment 22 Tomas Zezula 2009-04-03 07:41:19 UTC
Fixed jet-main:c8a4967de00c
Comment 23 Quality Engineering 2009-04-04 07:41:25 UTC
Integrated into 'main-golden', will be available in build *200904040200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c8a4967de00c
User: Tomas Zezula <tzezula@netbeans.org>
Log: #150540:IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
Comment 24 David Strupl 2009-04-15 09:10:37 UTC
*** Issue 162647 has been marked as a duplicate of this issue. ***
Comment 25 Milan Kubec 2009-04-15 13:42:51 UTC
*** Issue 162674 has been marked as a duplicate of this issue. ***
Comment 26 Martin Entlicher 2009-11-02 14:22:02 UTC
Build: NetBeans IDE Dev (Build 200910310201)
VM: Java HotSpot(TM) Client VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Linux, 2.6.22-14-generic, i386

User Comments: 


Stacktrace: 
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
        at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1809)
        at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1320)
        at org.openide.util.Mutex.readAccess(Mutex.java:275)
        at org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.<init>(TreeView.java:2128)
        at org.openide.explorer.view.TreeView$ExplorerTree.paint(TreeView.java:1838)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
Comment 27 Martin Entlicher 2009-11-02 14:22:15 UTC
Created attachment 90427 [details]
stacktrace
Comment 28 J Bachorik 2010-03-24 08:39:19 UTC
Created attachment 95639 [details]
stacktrace
Comment 29 Alexandr Scherbatiy 2010-04-19 07:14:11 UTC
Created attachment 97588 [details]
stacktrace


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo