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.
Starting with a fresh install, opened a Java web application project. NetBeans froze as the "Opening Projects" dialog was displayed. I am attaching a thread dump.
Created attachment 83687 [details] Thread dump
seems to be something with web project and libraries interaction, reassigning to web/project for evaluation. (other alternative is java/platform I guess.)
Tomas, this reminds me of issue 162575 and I would ask the same questions again "Perhaps java.j2seplatform.libraries.J2SELibraryTypeProvider should just post update to a different thread (if there are really some changes in property values)?"
I am already working on it. I will integrate it during weekend.
Not related to the issue #162575, but it's nearly the same as #166109 (deadlocks introduced by features on demand) where Jarda added waiting on FolderInstance. Removing the lock on the LibraryManager was easy by split of critical section, but this time the deadlock is caused by the project's mutex which was acquired by the WebProject before calling the LibraryManager (the libraries module cannot solve this, except of processing the events asynchronously (Folder Instance Processor thread) which is not a fix and it will introduce raceconditions). Anyway I still think that calling FolderInstance.waitFinished is not good idea.
The patch for async libs refresh, which I don't like as it's causes a raceconditition is here. The async call should be done only in the case of taskFinished. Jardo, any other idea?
Created attachment 84382 [details] Patch
The attached patch is not a "final" patch it's rather a sketch to show a possible solution if there is no nicer way. If we go this way I have to improve guarding of the shared state (LS.libraries).
Jardo, any progress on this?
I'll write a deadlock test and then I provide (a bit ugly) fix.
Created attachment 85075 [details] At the end the fix is not so ugly. Just trading a bit of correctness for deadlockfreeness. I was originally expecting something more horrible. Tomáši please comment.
Tomáš is said to be on vacation this week, I'll be the next one. Let's do post integration review: core-main#9e239b0332f2 The test is there and anyone can come up with better way to fix it later.
Integrated into 'main-golden', will be available in build *200907241401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/9e239b0332f2 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #167218: Don't wait for correctly computed result while holding ProjectMutex
Yes, I was on the vacation. The patch has two changes. 1st) The LibraryManager doesn't cache Libraries when it's called under project mutex. This may negatively affect performance as the LibraryManager is used mostly under project mutex => the cache will not be used. 2nd) LibrariesStorage.initStorage waits on LibraryTypeRegistry only in the case when the code is not called under project mutex. As the initStorage may be called under the project mutex (LibraryManager.addLibrary, LibraryManager.createLibrary) it may case that some library definitions will not be stored as the LibraryTypeProvider is not yet loaded. But I don't fully understand the LibraryTypeRegistry.getDefault().waitFinished() in the LibrariesStorage.initStorage. We should look at it again after vacations.
There is also problem that the waitFinished is called while holding the monitor on the LibrariesStorage at org.openide.util.RequestProcessor$Task.waitFinished(RequestProcessor.java:791) [junit] at org.openide.loaders.FolderInstance.waitFinished(FolderInstance.java:347) [junit] at org.netbeans.modules.project.libraries.LibrariesStorage.initStorage(LibrariesStorage.java:218) [junit] - locked <0x1632fc90> (a org.netbeans.modules.project.libraries.LibrariesStorage) [junit] at org.netbeans.modules.project.libraries.LibrariesStorage.getLibraries(LibrariesStorage.java:319) [junit] - locked <0x1632fc90> (a org.netbeans.modules.project.libraries.LibrariesStorage)
Fixed in jet-main: 1399f036a1db
Integrated into 'main-golden', will be available in build *200908050201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/1399f036a1db User: Tomas Zezula <tzezula@netbeans.org> Log: #167218:Race condition in the LibrariesStorage