Created attachment 107370 [details]
Dev build. Had created an nbm-packaging project from snapshot archetype (no junit dep), and asked to add a JUnit test to it. When I clicked Finish, the IDE froze while reindexing all repos. Not yet sure what is waiting for what.
Created attachment 107371 [details]
Still frozen after indexing complete, so a true deadlock
No time to fix in 7.0 now; no other known occurrences; observed in a dev build but probably possible in 7.0 as well.
1. junit.wizards.EmptyTestCaseWizardIterator.instantiate runs synchronously in EQ; probably should create a progress handle. Would not be a fix the problem but might at least reduce its severity by allowing you to e.g. save modified files from the UI.
2. EQ is waiting to enter a transaction in POMModelImpl. Thread dump does not make it obvious which thread, if any, is already in a transaction in the model. Probably maven.hints.pom.StatusProvider$StatusProviderImpl.checkHints(StatusProvider.java:127), which may have a lock ordering conflict with junit.DefaultPlugin.storeProjectSettingsJUnitVer(DefaultPlugin.java:1601). Note that this is in the older and more commonly used variant of checkHints (where there is no text selection); the new fix of bug #190041 (so far only in dev sources) adds a transaction lock to the less commonly used variant not implicated here.
If the guess in #2 is correct, then the simplest fix would be to remove the transaction lock in both checkHints variants, though I have no clue what race conditions that might introduce.
ParentVersionError is also a little odd because it is trying to load a project from an editor hint. But I do not see any other way it could work - parsing ../pom.xml as text would not pick up inherited fields easily.
StatusProviderImpl could perhaps enter ProjectManager.mutex in read mode before acquiring the transaction lock, which would order the locks properly. This would mean it would "know" that hint implementations are loading projects, which is poor encapsulation (one of the arguments for STM).
Fix presupposes 1cace8861cab and 5dd3d1dd5a8e.
Integrated into 'main-golden', will be available in build *201104120401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jesse Glick <firstname.lastname@example.org>
Log: #197208: Freeze adding test to module
Acquire Project.mutex before acquiring XAM transaction lock, since ParentVersionError will need it anyway.