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 35938 - Synchronization related problem in ProjectMember
Summary: Synchronization related problem in ProjectMember
Status: CLOSED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 3.x
Hardware: Sun SunOS
: P1 blocker with 1 vote (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: THREAD
Depends on:
Blocks:
 
Reported: 2003-09-05 22:12 UTC by Chris Webster
Modified: 2004-04-19 16:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ProjectMember suggested fix (2.43 KB, patch)
2003-09-05 22:14 UTC, Chris Webster
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Webster 2003-09-05 22:12:58 UTC
I encountered a synchronization related problem
whereby code which creates a file directly in the
project file system (containers) and then attempts
to obtain an entry from the project environment
sometimes does not succeed. The code slice is
listed below. The problem appears to be in the
ProjectMember.Environment.beforeLookup. The
following sequence of events would cause a problem
on an uninitialized project member:

Thread1
  beforeLookup
     if (getLookup().length == 0) // true
      // item is valid
      if (!environmentConstruction) 
        environmentConstruction = true;
surrenders control

Thread2
   beforeLookup
     if (getLookup().length == 0) // true
      // item is valid
      if (!environmentConstruction) 
       
returns empty lookup.


I have attached a patch which passed the unit
tests and resolves the problem on the target system.


Example code slice.

FileObject fo =
containers.createData(resourceName,   RESOURCE_EXT);
ProjectMember pm = p.getProjectMember(fo);
ResourceDescriptor resource = (ResourceDescriptor)
                 
pm.getLookup().lookup(ResourceDescriptor.class);
Comment 1 Chris Webster 2003-09-05 22:14:55 UTC
Created attachment 11534 [details]
ProjectMember suggested fix
Comment 2 Vitezslav Stejskal 2003-09-08 09:04:03 UTC
Thanks for good report. I already observed something similar when
working with jarpackager, but haven't time to track it down. Also
thanks for the patch, unfortunately I think it will cause deadlocks.
There was already such kind of synchronization and I removed it
because of deadlocks. The threading issues related to ProjectMembers
definitely deserve some effort. I was hoping to get some aid from
Jesse's Threading Model Proposal, but it seems to be still in the very
early stage. So, I guess we should try to improve it on our own.
Comment 3 Chris Webster 2003-09-09 20:36:48 UTC
This blocking a studio milestone. I will need to apply the patch
9/10/2003 so that development can proceed.
Comment 4 Vitezslav Stejskal 2003-09-16 01:49:30 UTC
Well, if it seems to help in your situation go ahead and apply the
patch. Please, mention this issue in comment somewhere around changed
code to be aware of the problem in future. I am going to propose some
threading model for ProjectMembers soon and probably refactor this
code. Thanks for patch anyway.
Comment 5 Vitezslav Stejskal 2003-11-24 14:00:20 UTC
As described in
http://www.netbeans.org/servlets/ReadMsg?msgId=619519&listName=nbdiscuss the
current work on projects prototype has been stopped.
Comment 6 Jan Becicka 2003-11-25 13:46:54 UTC
Marking issue as VERIFIED --->
Comment 7 Jan Becicka 2003-11-25 13:51:27 UTC
---> CLOSED