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 64582 - Deadlock due to the messy code for the evaluator manipulation/synchronization
Summary: Deadlock due to the messy code for the evaluator manipulation/synchronization
Status: VERIFIED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Martin Krauskopf
URL:
Keywords: THREAD
: 67234 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-17 07:04 UTC by Martin Krauskopf
Modified: 2005-11-16 18:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
deadlock (15.91 KB, text/plain)
2005-09-17 07:05 UTC, Martin Krauskopf
Details
tested deadlock (16.60 KB, text/plain)
2005-09-26 14:44 UTC, Martin Krauskopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Krauskopf 2005-09-17 07:04:28 UTC
....which I introduced with my previous commits. Already having test similator
for this deadlock. I'll fix it soon (as soon as I'll be online again). Fix
itself would be easy but could introduce another problems...
Comment 1 Martin Krauskopf 2005-09-17 07:05:38 UTC
Created attachment 24907 [details]
deadlock
Comment 2 Martin Krauskopf 2005-09-19 14:52:07 UTC
Should be fixed.

Checking in test/project/NbModuleProjectTest.java; 1.21 --> 1.22
Checking in test/project/ui/customizer/SuiteUtilsTest.java; 1.2 --> 1.3
Checking in NbModuleProject.java; 1.113 --> 1.114
Comment 3 Jesse Glick 2005-09-19 21:59:51 UTC
I don't believe the fix is correct. Entering write access from evaluator() is
dangerous, because you cannot guarantee that the caller of evaluator() is not in
read access - an illegal state transition.

I would repeat my previous suggestion of *not* trying to prevent evaluator()
from potentially computing a new evaluator twice in parallel threads; it is
probably rare, and definitely harmless so long as the final field assignment is
synchronized. If you *really* want to prevent this, it is possible, but quite
cumbersome: see ProjectManager for a (possibly slightly broken) example.
Comment 4 Martin Krauskopf 2005-09-20 04:12:13 UTC
P1 -> P2. Tested and presuambly works with the current implementation.
Comment 5 Martin Krauskopf 2005-09-26 12:43:22 UTC
Ok, just running under PM.m.readAccess instead of PM.m.writeAccess should be OK.
I'll try to write a test which will deadlock the current implementation and than
"switch" the access.
Comment 6 Martin Krauskopf 2005-09-26 14:44:39 UTC
Created attachment 25184 [details]
tested deadlock
Comment 7 Martin Krauskopf 2005-09-26 14:58:03 UTC
Fixed again.

Checking in test/project/NbModuleProjectTest.java; 1.22 --> 1.23
Checking in NbModuleProject.java; 1.114 --> 1.115
Comment 8 Jesse Glick 2005-10-20 19:58:59 UTC
*** Issue 67234 has been marked as a duplicate of this issue. ***
Comment 9 pzajac 2005-11-16 14:55:45 UTC
it seem's be ok
Comment 10 Jesse Glick 2005-11-16 18:02:41 UTC
Note that I just rewrote all this code yesterday. Had to throw out the test for
it since it relied on internals of the previous implementation.
Comment 11 Martin Krauskopf 2005-11-16 18:08:11 UTC
Yup, I've noticed this. Are those test irrelevant at all when implementation
were rewritten? Or should they be rewritten to fit current state?
Comment 12 Jesse Glick 2005-11-16 18:28:54 UTC
I have no idea; not sure what they were testing, other than that a certain usage
of a package-private method didn't deadlock something. If there is an externally
observable *scenario* that could deadlock somehow (e.g. I edit this file, then
delete this platform, etc.) then that can be tested, without reference to impl
details of the evaluator.
Comment 13 Martin Krauskopf 2005-11-16 18:45:07 UTC
Hmmm, probably you are right. They just tried to simulate thread dumps I've
received. I don't know if it was possible to go few step higher in stack traces
with keeping an ability to simulate those deadlocks. But anyway they tested
mainly problem in NbModuleProject.evaluator() which was complicated before and
is clean and simple now (just a getter). So I believe thay are irrelevant and
could be deleted.