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 10778 - Mutex should at least warn when trying to upgrade from readlock to writelock
Summary: Mutex should at least warn when trying to upgrade from readlock to writelock
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker (vote)
Assignee: Petr Nejedly
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-03-28 15:51 UTC by Petr Nejedly
Modified: 2013-12-04 20:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Adding a log sent to nbusers with two warnings (11.29 KB, text/plain)
2001-07-20 20:30 UTC, Petr Nejedly
Details
I got "WARNING: Going from readAccess to writeAccess, see #10778..." (14.94 KB, text/plain)
2001-07-20 20:48 UTC, David Konecny
Details
This series of exceptions raised, as I tried to use the new button in an index property in the properties dialog of a BeanNode (63.36 KB, text/plain)
2004-05-26 11:24 UTC, torsknod
Details
Stack trace for this exception (5.43 KB, text/plain)
2004-08-21 02:24 UTC, _ pcw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Nejedly 2001-03-28 15:51:21 UTC
It is currently possible to upgrade from readlock to writelock, but it is very
deadlock-prone, as the writer has to have exclusive access, so the upgrading
reader has to wait until it is the only reader. If there are two such upgraders,
it will mean deadlock. As it is not so unusual and there were deadlocks because
of this upgrade, I'll add warning in every such case to track it during
the fixing period (enabled by default). We can remove the warning before the
final build and/or disable the Mutex upgrade at all afterwards.
Comment 1 Petr Nejedly 2001-03-30 09:38:48 UTC
Warning added, with reference to this bug.
It can be disabled by -Dnetbeans.debug.nomutex=true,
but we need to have this on by default, until release.
Comment 2 Rochelle Raccah 2001-03-30 20:40:18 UTC
I just got this error with the build from 3/29:

WARNING: Going from readAccess to writeAccess
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:993)
        at org.openide.util.Mutex.enter(Mutex.java:407)
        at org.openide.util.Mutex.writeEnter(Mutex.java:357)
        at org.openide.util.Mutex.writeAccess(Mutex.java:312)
        at org.openide.nodes.Children$Array.add(Children.java:1070)
        at org.openide.nodes.Children$Keys.add(Children.java:1544)
        at org.openide.nodes.FilterNode$Children.add(FilterNode.java:859)
        at
org.netbeans.modules.beans.PatternsExplorerFactory.createClassNode(PatternsExplorerFactory.java:47)
        at
org.openide.src.nodes.FilterFactory.createClassNode(FilterFactory.java:75)
        at
org.netbeans.modules.corba.poasupport.POAExplorerFactory.createClassNode(POAExplorerFactory.java:39)
        at
org.openide.src.nodes.FilterFactory.createClassNode(FilterFactory.java:75)
        at
org.netbeans.modules.javadoc.comments.JavaDocPropertySupportFactory.createClassNode(JavaDocPropertySupportFactory.java:57)
        at
org.openide.src.nodes.SourceChildren.createNodes(SourceChildren.java:169)
        at org.openide.nodes.Children$Keys$KE.nodes(Children.java:1744)
        at org.openide.nodes.ChildrenArray.nodesFor(ChildrenArray.java:125)
        at org.openide.nodes.Children$Info.nodes(Children.java:879)
        at org.openide.nodes.Children.justComputeNodes(Children.java:397)
        at org.openide.nodes.ChildrenArray.nodes(ChildrenArray.java:69)
        at org.openide.nodes.Children.computeNodes(Children.java:315)
        at org.openide.nodes.Children$2.run(Children.java:253)
        at org.openide.util.Mutex.readAccess(Mutex.java:160)
        at org.openide.nodes.Children.getNodes(Children.java:251)
        at org.openide.nodes.Children.findChild(Children.java:207)
        at
org.openide.src.nodes.SourceChildren.findChild(SourceChildren.java:187)
        at org.openide.nodes.FilterNode$Children.findChild(FilterNode.java:834)
        at org.openide.nodes.NodeOp.findChild(NodeOp.java:199)
        at org.openide.nodes.NodeOp.findPath(NodeOp.java:217)
        at org.openide.nodes.NodeOp.findPath(NodeOp.java:245)
        at
org.openide.explorer.ExplorerManager.findPath(ExplorerManager.java:601)
        at
org.openide.explorer.ExplorerManager$MyValidation.run(ExplorerManager.java:742)
        at
org.openide.explorer.ExplorerManager$MyValidation.validateObject(ExplorerManager.java:730)
        at java.io.ObjectInputStream.doValidations(ObjectInputStream.java:618)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:490)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at
org.openide.util.io.NbMarshalledObject.get(NbMarshalledObject.java:88)
        at
org.openide.explorer.ExplorerPanel.readExternal(ExplorerPanel.java:226)
        at
org.netbeans.core.NbMainExplorer$ExplorerTab.readExternal(NbMainExplorer.java:484)
        at
org.openide.windows.TopComponent$Replacer.readObject(TopComponent.java:705)
        at java.lang.reflect.Method.invoke(Native Method)
        at
java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2213)
        at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1410)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at
org.openide.util.io.NbMarshalledObject.get(NbMarshalledObject.java:88)
        at
org.netbeans.core.windows.WindowManagerImpl$TopComponentManager.validateData(WindowManagerImpl.java:1343)
        at
org.netbeans.core.windows.frames.DefaultContainerImpl.validateData(DefaultContainerImpl.java:864)
        at
org.netbeans.core.windows.frames.DefaultContainerImpl.validateData(DefaultContainerImpl.java:837)
        at
org.netbeans.core.windows.frames.SplittedContainerImpl.validateData(SplittedContainerImpl.java:463)
        at org.netbeans.core.windows.ModeImpl.validateData(ModeImpl.java:1223)
        at
org.netbeans.core.windows.WorkspaceVisibilityManager.processModesValidation(WorkspaceVisibilityManager.java:323)
        at
org.netbeans.core.windows.WorkspaceVisibilityManager.validateModes(WorkspaceVisibilityManager.java:233)
        at
org.netbeans.core.windows.WorkspaceImpl.validateData(WorkspaceImpl.java:630)
        at
org.netbeans.core.windows.WindowManagerImpl$SerializationReplacer.readResolve(WindowManagerImpl.java:868)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.io.ObjectStreamClass.invokeMethod(ObjectStreamClass.java:1615)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:393)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at
org.openide.util.io.NbMarshalledObject.get(NbMarshalledObject.java:88)
        at
org.netbeans.modules.projects.PSupport.updateWindowManager(PSupport.java:832)
        at org.netbeans.modules.projects.PSupport.projectOpen(PSupport.java:252)
        at
org.netbeans.core.NbProjectOperation.setProject(NbProjectOperation.java:129)
        at
org.netbeans.core.NbProjectOperation.openOrCreateProject(NbProjectOperation.java:176)
        at org.netbeans.core.NonGui.run(NonGui.java:476)
        at org.netbeans.core.Main.run(Main.java:168)
        at org.openide.TopManager.initializeTopManager(TopManager.java:120)
        at org.openide.TopManager.getDefault(TopManager.java:81)
        at org.netbeans.core.Main.main(Main.java:255)
        at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90)
        at java.lang.Thread.run(Thread.java:484)
Comment 3 Petr Nejedly 2001-04-02 13:22:02 UTC
Created attachment 943 [details]
Adding a log sent to nbusers with two warnings
Comment 4 Jaroslav Tulach 2001-04-02 17:49:24 UTC
I have just changed the code in Children.Array to use MUTEX.postWriteRequest
instead of MUTEX.writeAccess and I hope both troubles mentioned here should
disappear. 

If not reopen the bug.
Comment 5 David Konecny 2001-04-03 09:06:00 UTC
Created attachment 954 [details]
I got "WARNING: Going from readAccess to writeAccess, see #10778..."
Comment 6 Jaroslav Tulach 2001-04-03 13:02:14 UTC
Change the code in DataObject to fix the problem reported by David.
Comment 7 Petr Nejedly 2004-01-16 14:33:35 UTC
Oh, the debugging patch get lost on branch and never popped up on
trunk. Reopening.
Comment 8 Jaroslav Tulach 2004-02-06 14:50:43 UTC
So what? Fix of close as want fix?
Comment 9 Petr Nejedly 2004-02-11 11:17:51 UTC
Fix!
Comment 10 Petr Nejedly 2004-02-11 15:33:04 UTC
Lost warning added, with no optional-off-flag and using ErrorManager.
openide/src/org/openide/util/Mutex.java,v1.60
Comment 11 Petr Nejedly 2004-02-11 17:27:38 UTC
Verified it prints a warning message in case of upgrade.
Comment 12 torsknod 2004-05-26 11:24:07 UTC
Created attachment 15148 [details]
This series of exceptions raised, as I tried to use the new button in an index property in the properties dialog of a BeanNode
Comment 13 torsknod 2004-05-26 11:32:37 UTC
I have posted an attachment with a series of exceptions with 
contained a link to this issue. I am new to the netbeans platform, 
so I don't know if they are caused by an error of me or this (fixed) 
bug is still existing. 
But getting an error because of a write lock seems to be strange for 
me. My entry gets added with the new button and I can see it. When I 
click on it, this series of exceptions raises. But I have no guess, 
why there should be a write lock open. 
 
Regards Torsten 
Comment 14 Petr Nejedly 2004-05-26 11:45:20 UTC
You spotted a bug in Index. This bug is alreadyfixed in current
NetBeans codebase.
Comment 15 _ pcw 2004-08-21 02:23:22 UTC
Just got this message on NB 3.6 FCS build.  See attachment for trace.
Comment 16 _ pcw 2004-08-21 02:24:57 UTC
Created attachment 17006 [details]
Stack trace for this exception
Comment 17 Petr Nejedly 2004-08-23 08:40:02 UTC
The code in java module that caused it was deleted for 4.0, so your
issue is fixed already.
Comment 18 Quality Engineering 2008-12-23 14:31:59 UTC
This issue had *1 votes* before move to platform component
Comment 19 Quality Engineering 2012-09-18 02:10:25 UTC
Integrated into 'main-golden', will be available in build *201209180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/70f6d82214c0
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#218431 - IllegalStateException: WARNING: Going from readAccess to writeAccess, see #10778: http://www.netbeans.org/issues/show_bug.cgi?id=10778
Comment 20 scott_tavares 2013-04-11 21:12:46 UTC
Just got this warning in v7.3. I'm kinda of a newbe to this so I din't know how to get a stack trace. But this started happening after I did a 'ant clean' from the command line while in the project dir. Not sure what to do here. any advice would be greatly appreciated.
Comment 21 scott_tavares 2013-04-11 21:25:24 UTC
Here is the stack trace:

java.lang.IllegalStateException: WARNING: Going from readAccess to writeAccess through queue, see #10778: http://www.netbeans.org/issues/show_bug.cgi?id=10778 
[catch] at org.openide.util.Mutex.enterImpl(Mutex.java:704)
	at org.openide.util.Mutex.enter(Mutex.java:636)
	at org.openide.util.Mutex.writeEnter(Mutex.java:614)
	at org.openide.util.Mutex.writeAccess(Mutex.java:435)
	at org.netbeans.modules.python.api.PythonPlatformManager.storePlatform(PythonPlatformManager.java:212)
	at org.netbeans.modules.python.api.PythonPlatformManager.getBundledPlatform(PythonPlatformManager.java:98)
	at org.netbeans.modules.python.api.PythonPlatformManager.load(PythonPlatformManager.java:176)
	at org.netbeans.modules.python.api.PythonPlatformManager.<init>(PythonPlatformManager.java:61)
	at org.netbeans.modules.python.api.PythonPlatformManager.getInstance(PythonPlatformManager.java:112)
	at org.netbeans.modules.python.project.ui.actions.RunSingleCommand.<init>(RunSingleCommand.java:34)
	at org.netbeans.modules.python.project.PythonActionProvider.<init>(PythonActionProvider.java:45)
	at org.netbeans.modules.python.project.PythonProject.createLookup(PythonProject.java:95)
	at org.netbeans.modules.python.project.PythonProject.<init>(PythonProject.java:72)
	at org.netbeans.modules.python.project.PythonProjectType.createProject(PythonProjectType.java:31)
	at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.loadProject(AntBasedProjectFactorySingleton.java:264)
	at org.netbeans.api.project.ProjectManager.createProject(ProjectManager.java:371)
	at org.netbeans.api.project.ProjectManager.access$300(ProjectManager.java:86)
	at org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:292)
	at org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:235)
	at org.openide.util.Mutex.readAccess(Mutex.java:332)
	at org.netbeans.api.project.ProjectManager.findProject(ProjectManager.java:235)
	at org.netbeans.modules.project.ui.OpenProjectList.URLs2Projects(OpenProjectList.java:1180)
	at org.netbeans.modules.project.ui.OpenProjectList.access$1400(OpenProjectList.java:137)
	at org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.loadOnBackground(OpenProjectList.java:461)
	at org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.run(OpenProjectList.java:381)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at java.io.PushbackInputStream.unread(PushbackInputStream.java:235)
	at org.netbeans.modules.uihandler.Installer.copyWithEncoding(Installer.java:1458)
	at org.netbeans.modules.uihandler.Installer$Submit.doShow(Installer.java:1634)
	at org.netbeans.modules.uihandler.Installer.displaySummary(Installer.java:1001)
	at org.netbeans.modules.uihandler.Installer.displaySummary(Installer.java:1010)
	at org.netbeans.modules.uihandler.UIHandler.run(UIHandler.java:219)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)


I have a python project module installed I found somewhere. It was getting stuck on a python project. I deleted the project from the disk and reopend NB7.3 and it resolved the issue
Comment 22 Quality Engineering 2013-11-22 02:46:25 UTC
Integrated into 'main-silver', will be available in build *201311220002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1da0b654addd
User: Tomas Mysik <tmysik@netbeans.org>
Log: #238621 - IllegalStateException: WARNING: Going from readAccess to writeAccess, see #10778:
Comment 23 nexoma 2013-12-02 18:28:51 UTC
java.lang.IllegalStateException: WARNING: Going from readAccess to writeAccess through queue, see #10778: http://www.netbeans.org/issues/show_bug.cgi?id=10778 
[catch] at org.openide.util.Mutex.enterImpl(Mutex.java:709)
	at org.openide.util.Mutex.enter(Mutex.java:641)
	at org.openide.util.Mutex.writeEnter(Mutex.java:619)
	at org.openide.util.Mutex.writeAccess(Mutex.java:440)
	at org.netbeans.modules.python.api.PythonPlatformManager.storePlatform(PythonPlatformManager.java:212)
	at org.netbeans.modules.python.api.PythonPlatformManager.getBundledPlatform(PythonPlatformManager.java:98)
	at org.netbeans.modules.python.api.PythonPlatformManager.load(PythonPlatformManager.java:176)
	at org.netbeans.modules.python.api.PythonPlatformManager.<init>(PythonPlatformManager.java:61)
	at org.netbeans.modules.python.api.PythonPlatformManager.getInstance(PythonPlatformManager.java:112)
	at org.netbeans.modules.python.project.ui.actions.RunSingleCommand.<init>(RunSingleCommand.java:34)
	at org.netbeans.modules.python.project.PythonActionProvider.<init>(PythonActionProvider.java:45)
	at org.netbeans.modules.python.project.PythonProject.createLookup(PythonProject.java:95)
	at org.netbeans.modules.python.project.PythonProject.<init>(PythonProject.java:72)
	at org.netbeans.modules.python.project.PythonProjectType.createProject(PythonProjectType.java:31)
	at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.loadProject(AntBasedProjectFactorySingleton.java:264)
	at org.netbeans.api.project.ProjectManager.createProject(ProjectManager.java:371)
	at org.netbeans.api.project.ProjectManager.access$300(ProjectManager.java:86)
	at org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:292)
	at org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:235)
	at org.openide.util.Mutex.readAccess(Mutex.java:337)
	at org.netbeans.api.project.ProjectManager.findProject(ProjectManager.java:235)
	at org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner(SimpleFileOwnerQueryImplementation.java:129)
	at org.netbeans.api.project.FileOwnerQuery.getOwner(FileOwnerQuery.java:102)
	at org.netbeans.modules.java.project.ProjectClassPathProvider.findClassPath(ProjectClassPathProvider.java:68)
	at org.netbeans.api.java.classpath.ClassPath.getClassPath(ClassPath.java:628)
	at org.netbeans.modules.parsing.impl.indexing.errors.Utilities.getSourceClassPathFor(Utilities.java:73)
	at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.computePersistentFile(TaskCache.java:438)
	at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.getErrors(TaskCache.java:140)
	at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.isInError(TaskCache.java:363)
	at org.netbeans.modules.parsing.impl.indexing.errors.ErrorAnnotator$1.run(ErrorAnnotator.java:313)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
Comment 24 markiewb 2013-12-04 20:54:09 UTC
(In reply to nexoma from comment #23)
> java.lang.IllegalStateException: WARNING: Going from readAccess to
> writeAccess through queue, see #10778:
> http://www.netbeans.org/issues/show_bug.cgi?id=10778 
> [catch] at org.openide.util.Mutex.enterImpl(Mutex.java:709)
> 	at org.openide.util.Mutex.enter(Mutex.java:641)
> 	at org.openide.util.Mutex.writeEnter(Mutex.java:619)
> 	at org.openide.util.Mutex.writeAccess(Mutex.java:440)
> 	at

BTW: Adding comments at a fixed issue won't help. 

I filed a new issue https://netbeans.org/bugzilla/show_bug.cgi?id=239131 against the python module.