Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 432753 - [ModelSet] Model re-loaded while closing editor; causes exceptions
Summary: [ModelSet] Model re-loaded while closing editor; causes exceptions
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: M7   Edit
Assignee: Christian Damus CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-14 12:03 EDT by Christian Damus CLA
Modified: 2014-04-15 13:23 EDT (History)
0 users

See Also:


Attachments
Exceptions in the log (23.81 KB, text/plain)
2014-04-14 12:03 EDT, Christian Damus CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2014-04-14 12:03:05 EDT
Created attachment 241977 [details]
Exceptions in the log

Papyrus 1.0 (Luna post M6) Git master as of commit 142f6b5.

In trying to reproduce bug 432737, I ran into exceptions in the automatic closing and re-opening of models that have a profile applied that needs migration.

The exceptions are of two kinds:  an IllegalStateException ("need write transaction to modify the model") and a ConcurrentModificationException (in the applied-stereotypes collections cached in the CacheAdapter).  Both bomb the re-loading of the resource, but nonetheless these models are then leaked in their entirety in the CacheAdapter for the remainder of the Eclipse session.

Curiously, the EMF Transaction editing-domain correctly diagnoses the problem as stemming from accidental proxy resolution during resource unload:  the ProxyModificationTrackingAdapter is the culprit in both cases.

Steps to reproduce:  (as in bug 432737)

1. Create and define a profile containing some stereotypes.
2. Apply the profile and one of its stereotypes (the same stereotype) in two models.
3. Save the models.
4. In the profile, change the name of the stereotype applied in step 2 to the models.
   Make sure the name is different than before.
5. Save and define the profile.
6. See the two models from step 2 closed and re-opened.
7. Let Papyrus re-apply the profile in both models when prompted (twice).
8. Save the models.
9. Look in the workspace log and see exceptions like those attached.
Comment 1 Christian Damus CLA 2014-04-14 12:59:57 EDT
I have pushed a Gerrit review:  https://git.eclipse.org/r/24987

This fixes the exceptions by updating the ProxyModificationTrackingAdapter to process added/removed contents only when the resource is loaded.  This ensures that it does not process objects that are removed because the resource is unloaded, which is what triggers the exceptions and consequent symptoms in the editor.
Comment 2 Christian Damus CLA 2014-04-15 13:23:39 EDT
The Gerrit change has been merged to master.