Bug 3575 - Deadlock in the MainClassUpdater
Deadlock in the MainClassUpdater
Product: nbscala
Classification: Unclassified
Component: source
: P2 major
: ---
Assigned To: dcaoyuan
Depends on:
  Show dependency treegraph
Reported: 2012-01-16 17:05 UTC by tzezula
Modified: 2012-01-18 15:57 UTC (History)
2 users (show)

See Also:

Thread dump (4.14 KB, text/plain)
2012-01-16 17:06 UTC, tzezula
Patch file (4.66 KB, patch)
2012-01-16 17:07 UTC, tzezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tzezula 2012-01-16 17:05:15 UTC
The MainClassUpdater is called from ProjectOpenHook and does parser operation.
For some reason the PathRegistry was not blocked by OpenProjects.get() and RepositoryUpdater right after was blocked by OpenProjects.get(). The OpenProject.get() blocks until all ProjectOpenFooks finish -> deadlock.
I am not able to reproduce it (seems as race in OpenProjects which for a while returns the non blocking Future).

In the NB 7.2 (after merge of the background_scan branch) it will be Ok to call ParserManager.parse() as it's done in MainClassUpdater but calling ParserManager.parseWhenScanFinished() will still cause deadlock in this case. It waits at the end of scan while the scan waits to the end of ProjectOpenHooks. So the code for NB 7.2 can stay as it is, but it's safer to start the MainClassUpdater asynchronously, the patch is attached.

The relevant threads from thread dump are attached deadlock.txt
Comment 1 tzezula 2012-01-16 17:06:22 UTC
Created attachment 21 [details]
Thread dump
Comment 2 tzezula 2012-01-16 17:07:10 UTC
Created attachment 22 [details]
Patch file
Comment 3 dcaoyuan 2012-01-18 15:57:07 UTC
Fixed in b27a83e3631b74b2ecffe5c1198e2b9da8913b48, thanks tzezula