| Summary: | [builder] QueuedBuildData missing synchronization | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Mark Christiaens <mark.g.j.christiaens> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | lieven.lemiengre, mark.g.j.christiaens, sebastian.zarnekow, sven.efftinge |
| Version: | 2.0.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Mark Christiaens
Until now org.eclipse.xtext.builder.impl.QueuedBuildData.queueURI(URI) is only called from the builder context which uses a single thread and locks the entire working tree in the workspace. Therefore synchronization was not necessary, but it wouldn't hurt to add it. Indeed, And I didn't mention that there are more member functions that need synchronization. I think getAndRemovePendingDeltas, isEmpty, getQueue, getAllRemainingURIs ... Anything that reads, writes the internal state. I'd rather remove the existing synchronized keywords than adding them on any member beforehand. There is no point in accessing it during a build. Maybe in-between builds but then clients should synchronize using workspace locking. The present synchronization is necessary since these methods are called from JDT reconciling threads. (In reply to comment #4) > The present synchronization is necessary since these methods are called from > JDT reconciling threads. That was to fast: I wanted to add that I don't think that a workspace lock is necessary just to push some URIs / Deltas into a queue. Looks like a ConcurrentModificiationException could happen if 'queueChanges' is called while the builder iterates over 'getAllRemainingURIs'. I think it's safe for now since the builder itself holds a workspace lock and (at least that's what I assume) the reconcile will try to lock the reconciled resource. However, as soon as we load resources in parallel, we'll have to create a copy in #getAllRemainingURIs (which is probably even faster to iterate than the iterables.concat ... (In reply to comment #7) > I think it's safe for now since the builder itself holds a workspace lock and > (at least that's what I assume) the reconcile will try to lock the reconciled > resource. Since the workspace is locked there shouldn't occur any changes triggering the JDT reconciler anyway. So the synchronized keyword seems superfluous for the current scenario. > However, as soon as we load resources in parallel, we'll have to > create a copy in #getAllRemainingURIs (which is probably even faster to iterate > than the iterables.concat ... I didn't get that was the underlying use case. Makes sense now. (In reply to comment #7) > I think it's safe for now since the builder itself holds a workspace lock and > (at least that's what I assume) the reconcile will try to lock the reconciled > resource. However, as soon as we load resources in parallel, we'll have to > create a copy in #getAllRemainingURIs (which is probably even faster to iterate > than the iterables.concat ... Not 2.1 |