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 239131 - java.lang.IllegalStateException: WARNING: Going from readAccess to writeAccess through queue in python at org.netbeans.modules.python.api.PythonPlatformManager.storePlatform
Summary: java.lang.IllegalStateException: WARNING: Going from readAccess to writeAcces...
Status: VERIFIED FIXED
Alias: None
Product: python
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Jenselme
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-04 20:53 UTC by markiewb
Modified: 2015-07-11 21:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-12-04 20:53:04 UTC
Taken from 
* https://netbeans.org/bugzilla/show_bug.cgi?id=10778#c23
* http://stackoverflow.com/questions/20359830/is-there-a-workaround-for-bug-10778-in-netbeans-going-from-readaccess-to-writea


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 1 Lou Dasaro 2015-05-18 05:05:58 UTC
I'm going to assume this has been fixed, since I've not seen it and I'm doing a LOT of testing on Python Platforms and Autodetect. Therefore resolving as fixed.

Please reopen ONLY if it occurs on a version of the plugin released after 17-May-2015, and provide a duplicable test case. Thank you.
Comment 2 Jenselme 2015-05-28 21:41:52 UTC
I still encounter this problem. Here are the steps to reproduce:
1. Launch netbeans
2. Open a python project
3. Close netbeans without closing the project
4. Relaunch netbeans

You should get the error. The python project is correctly reopened. If I close the project before exiting the IDE I don't have the error.

Version:
Product Version: NetBeans IDE Dev (Build 20150527-e8112fc19595)
Java: 1.7.0_79; OpenJDK 64-Bit Server VM 24.79-b02
Runtime: OpenJDK Runtime Environment 1.7.0_79-b14
System: Linux version 3.16.7-21-desktop running on amd64; UTF-8; fr_FR (nb)


Stacktrace:
WARNING [org.netbeans.core.startup.InstalledFileLocatorImpl]: module org.jython in /home/jenselme/.netbeans/dev does not own jython-2.7.0-rc3 at org.netbeans.modules.python.api.PythonPlatformManager.getBundledPlatform(PythonPlatformManager.java:70)
SEVERE [org.openide.util.Exceptions]
java.lang.IllegalStateException: WARNING: Going from readAccess to writeAccess, see #10778: http://www.netbeans.org/issues/show_bug.cgi?id=10778 
[catch] at org.netbeans.modules.openide.util.DefaultMutexImplementation.enterImpl(DefaultMutexImplementation.java:455)
        at org.netbeans.modules.openide.util.DefaultMutexImplementation.enter(DefaultMutexImplementation.java:405)
        at org.netbeans.modules.openide.util.DefaultMutexImplementation.writeEnter(DefaultMutexImplementation.java:381)
        at org.netbeans.modules.openide.util.DefaultMutexImplementation.writeAccess(DefaultMutexImplementation.java:290)
        at org.openide.util.Mutex.writeAccess(Mutex.java:299)
        at org.netbeans.modules.python.api.PythonPlatformManager.storePlatform(PythonPlatformManager.java:217)
        at org.netbeans.modules.python.api.PythonPlatformManager.getBundledPlatform(PythonPlatformManager.java:98)
        at org.netbeans.modules.python.api.PythonPlatformManager.load(PythonPlatformManager.java:180)
        at org.netbeans.modules.python.api.PythonPlatformManager.<init>(PythonPlatformManager.java:59)
        at org.netbeans.modules.python.api.PythonPlatformManager.getInstance(PythonPlatformManager.java:112)
        at org.netbeans.modules.python.project2.PythonProject2.findProjectProperties(PythonProject2.java:208)
        at org.netbeans.modules.python.project2.PythonProject2.isProject(PythonProject2.java:251)
        at org.netbeans.modules.python.project2.PythonProjectFactory.isProject(PythonProjectFactory.java:29)
        at org.netbeans.modules.python.project2.PythonProjectFactory.loadProject(PythonProjectFactory.java:36)
        at org.netbeans.modules.projectapi.nb.NbProjectManager.createProject(NbProjectManager.java:401)
        at org.netbeans.modules.projectapi.nb.NbProjectManager.access$300(NbProjectManager.java:94)
        at org.netbeans.modules.projectapi.nb.NbProjectManager$2.run(NbProjectManager.java:314)
        at org.netbeans.modules.projectapi.nb.NbProjectManager$2.run(NbProjectManager.java:243)
        at org.netbeans.modules.openide.util.DefaultMutexImplementation.readAccess(DefaultMutexImplementation.java:252)
        at org.openide.util.Mutex.readAccess(Mutex.java:250)
        at org.netbeans.modules.projectapi.nb.NbProjectManager.findProject(NbProjectManager.java:243)
        at org.netbeans.api.project.ProjectManager.findProject(ProjectManager.java:164)
        at org.netbeans.modules.project.ui.OpenProjectList.URLs2Projects(OpenProjectList.java:1260)
        at org.netbeans.modules.project.ui.OpenProjectList.access$1400(OpenProjectList.java:137)
        at org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.loadOnBackground(OpenProjectList.java:474)
        at org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.run(OpenProjectList.java:394)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
        at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
        at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Comment 3 Lou Dasaro 2015-05-29 21:52:12 UTC
Reporters: Please include stacktraces as _attachments_. Thank you.

Notes: The anomaly only occurs with Setuptools projects.
I tried some root cause analysis, using Julien's test case. Results:

1. I believe Line 24 of python.project2 - RunSingleCommand.java should be deleted (as it was in the corresponding python.project)... delete this line:
PythonPlatformManager manager = PythonPlatformManager.getInstance();

2. Some conflict might (?) exist in PythonProject2.findProjectProperties.
That's about as far as I can take it. Reassigning to original author...
Comment 4 Jenselme 2015-07-08 13:42:23 UTC
I was able to write a patch for this issue. You can get it here: https://bitbucket.org/Jenselme/nb-contrib/commits/branch/bz239131

The problem is that when loading the project properties or trying to auto-detect platforms in PythonPlatformManager, the project was trying to save the platform while only having read access to the file. I don't think it is necessary to save it here, so my patch basically remove the call to storePlatform. Furthermore, saving the platform doesn't work as explained here: https://netbeans.org/bugzilla/show_bug.cgi?id=252306

I wasn't able to figure out why it didn't happen when opening a project manually thought.

It would be great if I could get input on my patch quickly to finally close this issue.
Comment 5 Jenselme 2015-07-11 11:49:04 UTC
Solved by http://hg.netbeans.org/main/contrib/rev/b047cef8879f