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.
Summary: | Deadlock between NbMavenProjectImpl and MavenProjectPropsImpl | ||
---|---|---|---|
Product: | projects | Reporter: | Jesse Glick <jglick> |
Component: | Maven | Assignee: | Antonin Nebuzelsky <anebuzelsky> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | alexismp |
Priority: | P1 | Keywords: | THREAD |
Version: | 7.0 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Thread dump |
The problem here is that two threads are synchronizing on NbMavenProjectImpl, one thread at the end of opening the project in LazyLookup.beforeLookup() and the other thread (after reloading the project) in call to getOriginalMavenProject() through the MavenProjectPropsImpl getter method. They both are also synchronizing on MavenProjectPropsImpl. The methods of MavenProjectPropsImpl probably need to stay synchronized. What could help would be a modification of getOriginalMavenProject() method which would wait on synchronization only if project == null, i.e. change like this: - public @NonNull synchronized MavenProject getOriginalMavenProject() { + public @NonNull MavenProject getOriginalMavenProject() { if (project == null) { + synchronized (this) { + if (project == null) { project = loadOriginalMavenProject(true); } + } + } return project; } Jesse, can you review and comment? cc The suggested patch is double-checked locking, which is generally frowned upon. Better would probably be to have MavenProjectPropsImpl synchronize on the associated NbMavenProjectImpl rather than itself. Good idea. Thanks, Jesse. Fixed in core-main #ca1f94af7f4d Integrated into 'main-golden', will be available in build *201012110001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ca1f94af7f4d User: Antonin Nebuzelsky <anebuzelsky@netbeans.org> Log: #192421 - Deadlock between NbMavenProjectImpl and MavenProjectPropsImpl |
Created attachment 103299 [details] Thread dump Occurred to me today in 101124-3c968d669482. Tried to open a project which was unloadable (missing parent POMs I think); IDE stuck in Opening Project dialog and had to be killed.