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 189854 - IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
Summary: IllegalStateException: Should not acquire Children.MUTEX while holding Projec...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Jesse Glick
URL:
Keywords: THREAD
: 175883 (view as bug list)
Depends on: 192051
Blocks: 156972
  Show dependency tree
 
Reported: 2010-08-25 14:47 UTC by Jesse Glick
Modified: 2011-10-26 13:24 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 172143


Attachments
stacktrace (10.66 KB, text/plain)
2010-08-25 14:47 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2010-08-25 14:47:46 UTC
This bug was originally marked as duplicate of bug 156972, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 100825-17b3cdd7aa68)
VM: Java HotSpot(TM) Client VM, 17.0-b16, Java(TM) SE Runtime Environment, 1.6.0_21-b06
OS: Linux

User Comments:
jglick: Saved project properties of a Maven OSGi bundle.




Stacktrace: 
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
   at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1832)
   at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1326)
   at org.openide.util.Mutex.readAccess(Mutex.java:354)
   at org.openide.explorer.view.TreeView$TreePropertyListener.propertyChange(TreeView.java:1228)
   at org.openide.util.WeakListenerImpl$PropertyChange.propertyChange(WeakListenerImpl.java:196)
   at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
Comment 1 Jesse Glick 2010-08-25 14:47:52 UTC
Created attachment 101663 [details]
stacktrace
Comment 2 Jaroslav Tulach 2010-09-01 10:44:25 UTC
Rather than okListener, use just storeListener which is invoked outside of AWT thread. For complex I/O operations that shall be preferred solution anyway:

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -174,7 +174,7 @@
             Lookup context = Lookups.fixed(new Object[] { project, handle});
             Dialog dialog = ProjectCustomizer.createCustomizerDialog("Projects/org-netbeans-modules-maven/Customizer", //NOI18N
                                              context, 
-                                             preselectedCategory, listener, listener, null );
+                                             preselectedCategory, null, listener, null );
             dialog.addWindowListener( listener );
             listener.setDialog(dialog);
             dialog.setTitle( MessageFormat.format(
@@ -298,7 +298,6 @@
         // Listening to OK button ----------------------------------------------
         
         public void actionPerformed( ActionEvent e ) {
-            if (SwingUtilities.isEventDispatchThread()) {
                 if ( dialog != null ) {
                     dialog.setVisible(false);
                     dialog.dispose();
@@ -321,7 +320,6 @@
                         }
                     }
                 }
-            } else {
                 try {
                     project.getProjectDirectory().getFileSystem().runAtomicAction(new FileSystem.AtomicAction() {
                         public void run() throws IOException {
@@ -334,7 +332,6 @@
                     //TODO error reporting on wrong model save
                 }
             }
-        }
         
         // Listening to window events ------------------------------------------
Comment 3 Jesse Glick 2010-10-15 00:45:32 UTC
Original fix does not appear to have worked?
Comment 4 Jesse Glick 2010-10-15 15:54:12 UTC
That patch does not work. (1) A null OK listener is illegal. (2) Cannot call dialog.setVisible etc. off EQ. (3) XAM requires transactions to be finished in the same thread as the one which started them, in case EQ.

This is not a "complex I/O operation", it is saving edits to a single *.xml file. The real problem is DataNode$PropL.propertyChange, which acquires a mutex from a callback, which is very dangerous; should post Node changes asynchronously. Anything else is just a workaround.
Comment 5 Jesse Glick 2010-10-15 16:26:13 UTC
core-main #d010676c0380
Comment 6 Quality Engineering 2010-10-16 02:52:37 UTC
Integrated into 'main-golden', will be available in build *201010160000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/d010676c0380
User: Jesse Glick <jglick@netbeans.org>
Log: #189854: IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
Comment 7 Svata Dedic 2011-10-26 13:24:50 UTC
*** Bug 175883 has been marked as a duplicate of this bug. ***