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.

Bug 50829

Summary: Deadlock when using CVS add action (in explorer)
Product: projects Reporter: Peter Zavadsky <pzavadsky>
Component: Generic InfrastructureAssignee: Jesse Glick <jglick>
Status: RESOLVED WORKSFORME    
Severity: blocker CC: mentlicher
Priority: P2 Keywords: THREAD
Version: 4.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:
Attachments: Full thread dump when deadlocked
another deadlock on beta2

Description Peter Zavadsky 2004-10-25 22:42:35 UTC
Build 200409220845

Just adding several sources in a row using CVS Add
action (from explorer popup), leads to deadlock
fairly often on my machine.

Attaching full thread dump.
Comment 1 Peter Zavadsky 2004-10-25 22:48:57 UTC
Created attachment 18502 [details]
Full thread dump when deadlocked
Comment 2 Peter Zavadsky 2004-10-25 23:10:26 UTC
Created attachment 18503 [details]
another deadlock on beta2
Comment 3 Peter Zavadsky 2004-10-25 23:11:47 UTC
4.0 beta2

There is also another one which looks same, happened on beta2 (see the
above attachment), now I am not sure if it has to do with vcs impl or
project api, please evaluate, and assign accordingly.
Comment 4 Martin Entlicher 2004-10-26 10:06:22 UTC
Looks more like a projects issue. Two threads are waiting on
dir2Proj.wait(); but it seems to be never notified...
Comment 5 Jesse Glick 2004-10-26 20:50:11 UTC
No idea how to reproduce; never happened to me. Also you are using
beta 2; many things have changed since then in dev builds.

I did some analysis of ProjectManager.loadProject and determined that
it is possible to get a starved thread (producing a thread dump
similar to the ones you attach), but only if thread #1 starts to load
a project, then thread #2 asks for the same project but waits for #1
to get it first, then thread #1 throws an exception rather than
returning a valid result; in that case #2 will wait forever for a
result which is not coming. Reproduced this in a unit test and wrote a
fix for it. However this is probably a very rare situation, and from
your description of your problem, it is probably not what is happening
to you.

I did add some logging code to ProjectManager so you can run with

  -J-Dorg.netbeans.api.project.ProjectManager=0

to get a pretty detailed log of what it is doing during project loads.
If you can reproduce in a dev build with this trace information on, by
all means reopen with your log file.
Comment 6 Jesse Glick 2004-10-27 19:51:17 UTC
Fix for the problem I did find, and logging:

committed   * Up-To-Date  1.7        
projects/projectapi/nbproject/project.properties
committed   * Up-To-Date  1.6        
projects/projectapi/nbproject/project.xml
committed   * Up-To-Date  1.10       
projects/projectapi/src/org/netbeans/api/project/ProjectManager.java
committed   * Up-To-Date  1.7        
projects/projectapi/test/unit/src/org/netbeans/api/project/ProjectManagerTest.java
committed   * Up-To-Date  1.8        
projects/projectapi/test/unit/src/org/netbeans/api/project/TestUtil.java