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

Summary: IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
Product: projects Reporter: Jesse Glick <jglick>
Component: MavenAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED    
Severity: normal CC: giorgio42, jtulach
Priority: P2 Keywords: THREAD
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 172143
Bug Depends on: 192051    
Bug Blocks: 156972    
Attachments: stacktrace

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. ***