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 60073 - ProjectManager reentrancy sanity-check not working
Summary: ProjectManager reentrancy sanity-check not working
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on: 60371
Blocks: 60011
  Show dependency tree
 
Reported: 2005-06-15 15:24 UTC by Jesse Glick
Modified: 2008-02-21 09:07 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Debug logs. (6.53 KB, text/plain)
2005-06-15 16:22 UTC, Jan Lahoda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2005-06-15 15:24:26 UTC
The following code in ProjectManager.java:

if (Thread.currentThread() == loadingThread) {
    throw new IllegalStateException("Attempt to call ProjectManager.findProject
within the body of ProjectFactory.loadProject (hint: try using
ProjectManager.mutex().postWriteRequest(...) within the body of your Project's
constructor to prevent this)"); // NOI18N
}

was apparently not triggered in issue #60011 as it should have been. Why not?
Comment 1 Jan Lahoda 2005-06-15 16:19:56 UTC
I have added a few debug messages into ProjectManager and reproduced issue
#60011. The debug messages printed after I choosed "Finish" in the new project
dialog are attached. The reason why the check was not succesfull is that:
1. findProject(".../testcvs/working/test12/") is called, sets loadingThread
2. findProject(".../testcvs/working/test12/test/unit/") is called, sets
loadingThread, and then cleared (the loading of project is finished, obviously
no project found).
3. same as 2 for ".../testcvs/working/test12/test/".
4. another call for findProject(".../testcvs/working/test12/"), but
loadingThread is cleared by the previous findProject(s).
Comment 2 Jan Lahoda 2005-06-15 16:22:02 UTC
Created attachment 22718 [details]
Debug logs.
Comment 3 Jesse Glick 2005-06-21 17:26:35 UTC
Got it (thanks Jan). The check for reentrancy should be done right away, not
conditionally.
Comment 4 Jesse Glick 2005-06-21 18:44:16 UTC
committed     Up-To-Date  1.15       
projects/projectapi/src/org/netbeans/api/project/ProjectManager.java
Comment 5 Radko Najman 2005-06-28 11:29:24 UTC
Roll backed and reopened as proposed in issue #60371 - the patch caused lots of
IllegalStateExceptions in webapps project.
Comment 6 Jesse Glick 2005-10-14 23:29:24 UTC
No user-visible problem represented by this bug as far as I know; more of a
check on incorrectly written project types.
Comment 7 Jan Lahoda 2005-10-15 10:05:36 UTC
Setting target milestone to "future". Please change the TM if you disagree.
Comment 8 Milos Kleint 2008-02-21 09:07:59 UTC
most probably fixed. The code in ProjectManager is now changed. There is a loadingThread ThreadLocal variable that
contains a Set of FileObjects that are being queried from the current thread. That should cover the described scenario.