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 129554 - Race conditions when accesing the document
Summary: Race conditions when accesing the document
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Spring (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Rohan Ranade
URL:
Keywords:
: 128860 129024 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-07 15:02 UTC by Andrei Badea
Modified: 2008-03-26 14:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2008-03-07 15:02:48 UTC
Both the hyperlinking and code completion access the document (directly or indirectly through XMLSyntaxSupport) without
locking, or they assume that once computed data (tokens, elements from the XML element chain, etc.) will be present in
the document at a point in point subsequent to their creation. This assumption is wrong, since the document may have
changed.

For code completion, the simplest fix seems to be to create a copy of the document and use it for a whole single
invocation of the code completion.

For hyperlinking, creating a copy of the document may impact performance, so the fix could be to compute everything that
is needed to perform the hyperlinking in advance. Especially the hyperlinking should not put XML chain elements and/or
tokens in HyperlinkEnv. A related problem in hyperlinking might be that the current implementation makes illegal
assumptions about the calling order of HyperlinkProvider methods. The calling order of these methods is not guaranteed.
Comment 1 John Baker 2008-03-20 05:57:57 UTC
This appears to be a possible design issue.  

Is there a use case or set of reproducible steps that exposes this race condition?\

If no, then if it's a design issue then shouldn't this be an enhancement?
Comment 2 Andrei Badea 2008-03-20 14:33:50 UTC
> Is there a use case or set of reproducible steps that exposes this race condition?\

Not reliably, but both I and Rohan have encountered random exceptions that could have been caused by this.

> If no, then if it's a design issue then shouldn't this be an enhancement?

No because of the above and because I consider the current design simply too risky. Also, my experience is that once an
issue is marked as an enhancement, nobody cares about it in the next release.
Comment 3 Rohan Ranade 2008-03-21 17:23:05 UTC
Changes done for code completion in changeset 7ea8199d06d8 and 53c7bd59d19c
Comment 4 Rohan Ranade 2008-03-24 10:24:57 UTC
*** Issue 128860 has been marked as a duplicate of this issue. ***
Comment 5 Rohan Ranade 2008-03-24 10:27:19 UTC
*** Issue 129024 has been marked as a duplicate of this issue. ***
Comment 6 Rohan Ranade 2008-03-26 14:51:42 UTC
Changes done for hyperlinking in changeset 1f36276b6056, 4bb44156f3a3, 4e8723fd0868.