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 184413 - 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: javafx
Classification: Unclassified
Component: Platform (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Adam Sotona
URL:
Keywords: THREAD
Depends on:
Blocks:
 
Reported: 2010-04-19 07:25 UTC by Alexandr Scherbatiy
Modified: 2010-05-14 10:57 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 168187


Attachments
stacktrace (8.26 KB, text/plain)
2010-04-19 07:25 UTC, Alexandr Scherbatiy
Details
A lot of Illegal State exceptions (131.69 KB, image/png)
2010-04-19 07:30 UTC, Alexandr Scherbatiy
Details
stacktrace (8.26 KB, text/plain)
2010-05-05 16:08 UTC, Anton Chechel
Details
stacktrace (8.30 KB, text/plain)
2010-05-06 12:41 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr Scherbatiy 2010-04-19 07:25:36 UTC
This issue was reported manually by sunflower.
It already has 1 duplicates 


Build: NetBeans IDE 6.9 Beta (Build 201004182356)
VM: Java HotSpot(TM) Client VM, 14.1-b02, Java(TM) SE Runtime Environment, 1.6.0_15-b03
OS: Windows XP

Stacktrace: 
java.lang.IllegalStateException: Should not acquire Children.MUTEX while holding ProjectManager.mutex()
   at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1828)
   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:2152)
   at org.openide.explorer.view.TreeView$ExplorerTree.paint(TreeView.java:1859)
   at javax.swing.JComponent.paintChildren(JComponent.java:864)
Comment 1 Alexandr Scherbatiy 2010-04-19 07:25:47 UTC
Created attachment 97590 [details]
stacktrace
Comment 2 Alexandr Scherbatiy 2010-04-19 07:29:57 UTC
I use the NB 6.9 beta.
I downloaded a JavaFX project from the kenai server and tried changing the Main class in the properties dialog. The Edit Project Properties dialog appeared and after that I saw a lot of Illegal State exceptions.

See the attached screenshots.
Comment 3 Alexandr Scherbatiy 2010-04-19 07:30:59 UTC
Created attachment 97591 [details]
A lot of Illegal State exceptions
Comment 4 Jaroslav Tulach 2010-04-20 04:48:56 UTC
JavaFX shall not show dialogs while holding mutex:

at org.netbeans.modules.javafx.project.ui.customizer.JavaFXProjectProperties$1.run(JavaFXProjectProperties.java:426)
   at org.openide.util.Mutex.writeAccess(Mutex.java:433)
   at org.netbeans.modules.javafx.project.ui.customizer.JavaFXProjectProperties.save(JavaFXProjectProperties.java:426)
Comment 5 Adam Sotona 2010-04-20 06:40:30 UTC
This is a very old pattern used in many other projects. It requires to ask user to re-generate build-impl.xml file if found modified during Save.
The write mutex is critical to hold during the whole action and the dialog is very simple, just some text and two buttons.
Could you, please, explain why such simple dialog takes care about any Mutex?

If it is so important to provide this detection, what is the suggested approach?
Should I fake it by starting the dialog in another thread and then wait for it, even it should be synchronous?
Are there any side-effects of a dialog show which could cause a deadlock? Should I better use the Swing JDialog directly? 

Thanks,
Adam
Comment 6 Peter Pis 2010-04-20 11:17:23 UTC
*** Bug 184527 has been marked as a duplicate of this bug. ***
Comment 7 Adam Sotona 2010-04-20 11:40:35 UTC
OK, no answer, just reassigned back.

Another issue marked as duplicate. It seems that Web Project also needs to show a dialog while holding ProjectManager.mutex.

Sorry, but these issues cannot be fixed in JavaFX.
Comment 8 Jaroslav Tulach 2010-04-20 12:46:35 UTC
Fine, fix in JavaFX, reassign to Web. There is nothing that can be done in platform/nodes or platform/explorer. In case you disagree, close the issue at your own responsibility.

I can only repeat, that showing dialogs while holding global locks is not allowed.
Comment 9 Jaroslav Tulach 2010-04-20 12:56:02 UTC
(In reply to comment #5)
Jesse will anwer your comments.
Comment 10 Jesse Glick 2010-04-20 18:24:37 UTC
(In reply to comment #5)
> This is a very old pattern used in many other projects.

Long since fixed in j2seproject.

> If it is so important to provide this detection, what is the suggested
> approach?

Do not show any dialog. See c8a4967de00c and cc2f5bfb4213 for example. (A helper API for this may be feasible.)
Comment 11 Anton Chechel 2010-05-05 16:08:24 UTC
Created attachment 98503 [details]
stacktrace
Comment 12 Exceptions Reporter 2010-05-05 16:08:33 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=168187
Comment 13 Exceptions Reporter 2010-05-06 12:41:28 UTC
Created attachment 98561 [details]
stacktrace

Setting application parameters
Comment 14 Adam Sotona 2010-05-10 14:28:12 UTC
fixed in http://hg.netbeans.org/javafx/rev/2b508644e094
Comment 15 Alexandr Scherbatiy 2010-05-14 10:57:03 UTC
verified in netbeans-trunk-nightly-201005132200-javafx-full-windows.exe