Created attachment 103031 [details]
Create maven web project, open project properties, go to Run section, select glassfish as a server, click in text field below, press close.
Saving will never finish, have to kill ide.
See thread dump.
might be related to fix of issue 189854
While retesting a different issue this deadlock happened to me several times in last 5 minutes. The scenario is: start yesterday's build with dozen of test projects of misc types and:
* open project properties of a Maven Web Project
* in Run Panel change server selection and confirm the panel
repeating these two steps twice the deadlock always seems to happen when panel is confirmed second time. HTH.
Cannot yet reproduce.
Not sure if this is related to the other XAM/XDM-related hangs.
In one thread, ProjectManager.mutex is held because the project is being saved, and POMModelImpl.endTransaction is waiting for a monitor. In the other, POMModelImpl.endTransaction is already being called, and ProjectManager.mutex is requested just to find the encoding of a file, pom.xml I suppose. Not sure how XDMModel.flushDocument could fail to already have the Document in hand. Also not clear to me how both branches of actionPerformed are being executed.
Saving of Maven project properties is mess or I'm just lazy to try to understand it. Or both. Why something has to be done in AWT thread and something in background thread? Is not it little bit too complicated?
I fixed recently http://hg.netbeans.org/web-main/rev/77dd5b4721f7 where WebRunPanelProvider was expecting that task in AWT thread is finished before background one runs. But that was not happening and assert failed randomly. My fix avoided the assert. Now I'm looking at issue 192525 which might be unrelated but: Maven pom.xml is *sometimes* not saved when project properties are closed.
(In reply to comment #4)
> Or both.
> Why something has to be done in AWT thread and
> something in background thread? Is not it little bit too complicated?
It is indeed too complicated. It is a workaround for a seemingly arbitrary restriction in XAM. The lock on the POM model is acquired in EQ, and XAM refuses to let you end a transaction from a different thread. I could not find a simpler fix.
I tried to fix in core-main #c371edaef3bc. Since I don't fully understand how the Maven customizer dialog works, I just rearranged some blocks of code until I found something that seems to save changes without throwing any exceptions or deadlocking. Please test.
With your fix I cannot reproduce the deadlock anymore and it seems to resolve also my issue 192525. Brilliant! :-)
Integrated into 'main-golden', will be available in build *201012010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jesse Glick <email@example.com>
Log: Attempt to fix #192051 - hang saving projects.