Re: Deadlock in WorkspaceSynchronizer [message #71236] |
Fri, 09 February 2007 16:33 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Alex,
As Cherie indicates, the correct newsgroup for EMFT questions is
eclipse.technology.emft (which I have copied).
Technically, a transaction is not required for saving or loading resources,
because transactions only protect the data contained by resources in the
resource set. So, one work-around for you would be to perform your
multi-resource save not in a transaction.
Of course, one does want to avoid the possibility of updates concurrent with
saving, which is the purpose of read-only transactions (in which save is
performed). So, possibly a better solution in the WorkspaceSynchronizer
would be to not do the runExclusive. I think this may not be necessary
because the default action always involves unloading the resource (custom
sync delegates may do more) and the synchronizer must assume that the
resource change may have been triggered within a transaction.
Please raise a bug, and I will investigate further.
Thanks!
Alex Shatalin wrote:
> Hello!
>
> While working with the WorkspaceSynchronizer I found a deadlock. For me it
> looks like a frequent situation, so can somebody from the runtime team
> review this posting and answer the question how to handle this situation
> correctly.
>
> Precondition: WorkspaceSynchronizer was instantiated and tracking any
> resource changes in the underlying ResourceSet.
>
> Thread-1: OpenEditPolicy.doExecuteWithResult() executed, model loaded into
> this ResourceSet was modified and saving action for whole ResourceSet was
> executed. First resource loaded into this ResourceSet saved using
> Resource.save() call.
>
> Thread-2: WorkspaceSynchronizer receive notification from the resource
> subsystem -> ResourceSynchJob executed and stopped in SynchRequest.
> Perform() method because of synch.getEditingDomain().runExclusive() call
> (Thread-1 AFAIU is currently inside a transaction in the same
> EditingDomain, so this call can not be satisfied).
>
> Thread-1: trying to save second resource from the same ResourceSet and
> stopped in: File.setContents() because of workspace.prepareOperation(rule,
> monitor); call. This operation is trying to execute job with the
> corresponding rule, but can not because WorkspaceSynchronizer.
> ResourceSynchJob is already running with the following rule:
> ResourcesPlugin.getWorkspace().getRoot().
>
> So, looks like this deadlock will show up any time we have
> WorkspaceSynchronizer running and trying to save more then one resource
> from within transaction executed on the same EditngDomain. My question is:
> should I submit a request for it? Or is there any other way to save
> resources correctly? (outside the transaction?)
>
> -----------------
> Alex Shatalin
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03526 seconds