Bug 494128 - Exception when importing project
Summary: Exception when importing project
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.0.0   Edit
Assignee: Laurent Redor CLA
QA Contact: Maxime Porhel CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-05-20 05:45 EDT by Laurent Goubet CLA
Modified: 2016-06-24 07:59 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Goubet CLA 2016-05-20 05:45:20 EDT
This was done in Eclipse Neon RC1, freshly installed from the SDK

1. install UML Designer (latest nightly - version 7.0.0.201603291431)
2. File > New > Example... > Travel Agency UML
3. Expand the new project.

The session will open when expanding the project, and the following exception be thrown :


java.lang.IllegalArgumentException: Attempted to beginRule: L/TravelAgency/representations.aird, does not match outer scope rule: org.eclipse.sirius.business.api.modelingproject.AbstractRepresentationsFileJob$1@155e70a3
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJob.java:134)
	at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java:333)
	at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:85)
	at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:307)
	at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:121)
	at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2188)
	at org.eclipse.core.internal.resources.File.setContents(File.java:334)
	at org.eclipse.core.internal.resources.File.setContents(File.java:434)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$PlatformResourceOutputStream.flush(PlatformResourceURIHandlerImpl.java:133)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$PlatformResourceOutputStream.close(PlatformResourceURIHandlerImpl.java:89)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper$1.close(PlatformResourceURIHandlerImpl.java:175)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1003)
	at org.eclipse.sirius.common.tools.api.resource.ResourceSetSync.doSave(ResourceSetSync.java:557)
	at org.eclipse.sirius.common.tools.api.resource.ResourceSetSync.save(ResourceSetSync.java:509)
	at org.eclipse.sirius.business.api.session.AbstractSavingPolicy.save(AbstractSavingPolicy.java:59)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$1.run(DAnalysisSessionImpl.java:796)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave(DAnalysisSessionImpl.java:806)
	at org.eclipse.sirius.business.internal.session.danalysis.Saver.wrappedSave(Saver.java:145)
	at org.eclipse.sirius.business.internal.session.danalysis.Saver.saveNow(Saver.java:114)
	at org.eclipse.sirius.business.internal.session.danalysis.Saver.transactionClosed(Saver.java:85)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$LifecycleImpl.fireLifecycleEvent(TransactionalEditingDomainImpl.java:1383)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$LifecycleImpl.transactionClosed(TransactionalEditingDomainImpl.java:1401)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:733)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
	at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
	at org.obeonetwork.dsl.uml2.design.api.utils.UmlViewpoints.enableReused(UmlViewpoints.java:73)
	at org.obeonetwork.dsl.uml2.design.internal.listeners.UmlDesignerSessionListener.notify(UmlDesignerSessionListener.java:44)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.notifyListeners(DAnalysisSessionImpl.java:1019)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.open(DAnalysisSessionImpl.java:1181)
	at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.performOpenSession(OpenRepresentationsFileJob.java:149)
	at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.runInWorkspace(OpenRepresentationsFileJob.java:113)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Pierre-Charles David CLA 2016-05-20 08:28:15 EDT
Very probably caused by/related to Bug #490164 - Give better feedback on unsuccesful session opening, and in particular https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=2acb5761b8e4fffc836e0f21354438c3608f3bd6 which introduces the AbstractRepresentationsFileJob$1 class visible in the stack.
Comment 2 Cedric Brun CLA 2016-05-23 10:16:47 EDT

A change recently submitted to EcoreTools and which could be related..(or not) but it adds a new "Waiting" call in the wizard.

https://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/commit/?id=0ef6f91fa10f2aedc3c2f9bd2806400a76aaf59f
Comment 3 Laurent Redor CLA 2016-05-24 10:05:31 EDT
This bug seems not linked to UML Designer. I have the same stack with a modeling project containing a basicfamily semantic model. No idea how to reproduce this problem for the moment.
Comment 4 Laurent Redor CLA 2016-05-24 10:30:28 EDT
To complete comment 3, the stacktrace is not exactly the same:
java.lang.RuntimeException: The modeling project "basicfamily.sample" is invalid: Problem during loading models: Attempted to beginRule: P/basicfamily.sample, does not match outer scope rule: org.eclipse.sirius.business.api.modelingproject.AbstractRepresentationsFileJob$1@ad69e04
	at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.runInWorkspace(OpenRepresentationsFileJob.java:123)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.IllegalArgumentException: Attempted to beginRule: P/basicfamily.sample, does not match outer scope rule: org.eclipse.sirius.business.api.modelingproject.AbstractRepresentationsFileJob$1@ad69e04
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJob.java:134)
	at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java:333)
	at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:85)
	at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:307)
	at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:121)
	at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2188)
	at org.eclipse.core.internal.resources.Resource.refreshLocal(Resource.java:1586)
	at org.eclipse.core.internal.resources.File.refreshLocal(File.java:316)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper.createPlatformResourceInputStream(PlatformResourceURIHandlerImpl.java:205)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:525)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:354)
	at org.eclipse.sirius.business.internal.migration.AbstractVersionSAXParser.getVersion(AbstractVersionSAXParser.java:74)
	at org.eclipse.sirius.business.internal.resource.AirDResourceFactory.createResource(AirDResourceFactory.java:95)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:434)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandCreateResource(ResourceSetImpl.java:243)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$ResourceLocator.demandCreateResource(ResourceSetImpl.java:772)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$MappedResourceLocator.getResource(ResourceSetImpl.java:1199)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:352)
	at org.eclipse.sirius.business.internal.session.SessionFactoryImpl.loadSessionModelResource(SessionFactoryImpl.java:118)
	at org.eclipse.sirius.business.internal.session.SessionFactoryImpl.createSession(SessionFactoryImpl.java:102)
	at org.eclipse.sirius.business.internal.session.SessionManagerImpl.getSession(SessionManagerImpl.java:253)
	at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.performOpenSession(OpenRepresentationsFileJob.java:143)
	at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.runInWorkspace(OpenRepresentationsFileJob.java:113)
	... 2 more
Comment 5 Laurent Redor CLA 2016-05-24 12:49:37 EDT
I have the steps to reproduce systematically scenario of comment 3 but it needs to put breakpoint in the code (to avoid the unreliable reproduction conditions) :
* Launch a workspace with the Sirius code
* Launch a runtime
* Create a VSP with a basicfamily as semantic model, activate the Viewpoint "persons" and create a simple diagram
* Close all opened editors
* Close the runtime
* Add a breakpoint at line 203 of org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.WorkbenchHelper.createPlatformResourceInputStream(String, Map<?, ?>): 
On the line "if (!file.isSynchronized(IResource.DEPTH_ONE))"
* Restart the runtime
* Expand the VSP
* The debug stops on the breakpoint
* Modify the aird file with an external editor (add a blank line for example)
* Resume the debug: KO you have the same problem as explained in comment 3.
Comment 6 Eclipse Genie CLA 2016-05-25 05:24:14 EDT
New Gerrit change created: https://git.eclipse.org/r/73568
Comment 7 Eclipse Genie CLA 2016-05-26 03:44:35 EDT
New Gerrit change created: https://git.eclipse.org/r/73690
Comment 8 Laurent Redor CLA 2016-05-26 05:14:00 EDT
After analysis, the rule added to AbstractRepresentationsFileJob in bug 490164 to avoid conflicting execution is not enough. Indeed, during the execution of this job, some resources modifications in worskpace can occur. So the rule of this job must "include" rules of such modifications. The Workspace rule is the right one as modications can concern all files (according to Viewpoint Modeling project dependency).

The gerrit https://git.eclipse.org/r/73568 concerns this changes.
Comment 9 Laurent Redor CLA 2016-05-26 05:24:14 EDT
With the change of gerrit https://git.eclipse.org/r/73568, we can observe a deadlock on ModelingToggleNatureAction.
To resume, the ModelingToggleNatureAction takes the lock on "Workspace Rule", schedules the job OpenRepresentationsFileJob and wait the end of the execution of the job.
The OpenRepresentationsFileJob needs the "Workspace Rule" to be launched: deadlock.

Randum failures occur on ConvertProjectToModelingProjectTest.testConvertToModelingProjectWithoutRepresentationFileButSemanticResources. This is probably linked to the above problem (but now more clearly identified by a deadlock).

The gerrit https://git.eclipse.org/r/73690 explicitly launches the action in a workspace modify operation with workspace scheduling rule and does not scheduled a job for the representations file opening but directly executes it.
Comment 12 Laurent Redor CLA 2016-05-26 07:57:12 EDT
Fixed in Sirius 4.0 RC3
Comment 13 Maxime Porhel CLA 2016-05-26 12:07:28 EDT
Validated on Sirius 4.0.0.201605261201 with remote debug. 

Conversion of project to a modeling project with and without exisitng aird also works fine.
Comment 14 Pierre-Charles David CLA 2016-06-24 07:59:52 EDT
Available in Sirius 4.0.0.