Bug 192421 - Deadlock between NbMavenProjectImpl and MavenProjectPropsImpl
Deadlock between NbMavenProjectImpl and MavenProjectPropsImpl
Status: RESOLVED FIXED
Product: projects
Classification: Unclassified
Component: Maven
7.0
PC Linux
: P1 (vote)
: 7.0
Assigned To: Antonin Nebuzelsky
issues@projects
: THREAD
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-24 17:08 UTC by Jesse Glick
Modified: 2010-12-11 06:32 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
Thread dump (20.67 KB, text/plain)
2010-11-24 17:08 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2010-11-24 17:08:48 UTC
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.
Comment 1 Antonin Nebuzelsky 2010-12-10 13:25:04 UTC
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?
Comment 2 alexismp 2010-12-10 13:52:40 UTC
cc
Comment 3 Jesse Glick 2010-12-10 14:20:39 UTC
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.
Comment 4 Antonin Nebuzelsky 2010-12-10 15:50:00 UTC
Good idea. Thanks, Jesse.

Fixed in core-main #ca1f94af7f4d
Comment 5 Quality Engineering 2010-12-11 06:32:37 UTC
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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo