eclipsesource / papyrus-seqd

1 stars 5 forks source link

MInteractionTest.testSort() randomly throws IllegalArgumentException #442

Closed planger closed 5 years ago

planger commented 5 years ago

The culprit is the following line:

Collections.shuffle(shuffle);

Depending on the order, it may throw the IAE detailed below. To reproduce, you can set this random seed to see how it passes:

Collections.shuffle(shuffle, new Random(1l));

and this seed to see how it fails:

Collections.shuffle(shuffle, new Random(2l));

The stack trace is as follows


java.lang.IllegalArgumentException: dependency cycle: [ExecutionOccurrenceSpecification(AnchorsModel::ExecutionSpecificationAnchors::Execution1-start), ActionExecutionSpecification{G}(AnchorsModel::ExecutionSpecificationAnchors::ActionExecutionSpecification1, Shape_Execution_Specification)]
    at org.eclipse.papyrus.uml.interaction.internal.graph.EdgeImpl.checkForCycle(EdgeImpl.java:161)
    at org.eclipse.papyrus.uml.interaction.internal.graph.EdgeImpl.<init>(EdgeImpl.java:41)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphComputer.edge(GraphComputer.java:101)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphComputer.edge(GraphComputer.java:123)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphComputer$EdgeFactory.lambda$11(GraphComputer.java:411)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphComputer$EdgeFactory.caseExecutionSpecification(GraphComputer.java:411)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphComputer$EdgeFactory.caseExecutionSpecification(GraphComputer.java:1)
    at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:4899)
    at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
    at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphComputer.compute(GraphComputer.java:92)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphImpl.<init>(GraphImpl.java:86)
    at org.eclipse.papyrus.uml.interaction.internal.graph.GraphImpl.getInstance(GraphImpl.java:115)
    at org.eclipse.papyrus.uml.interaction.graph.Graph.compute(Graph.java:243)
    at org.eclipse.papyrus.uml.interaction.internal.model.impl.InteractionModelBuilder.<init>(InteractionModelBuilder.java:52)
    at org.eclipse.papyrus.uml.interaction.internal.model.impl.InteractionModelBuilder.getInstance(InteractionModelBuilder.java:78)
    at org.eclipse.papyrus.uml.interaction.model.MInteraction.getInstance(MInteraction.java:57)
    at org.eclipse.papyrus.uml.interaction.model.tests.MElementTest.execute(MElementTest.java:394)
    at org.eclipse.papyrus.uml.interaction.model.tests.MElementTest.execute(MElementTest.java:385)
    at org.eclipse.papyrus.uml.interaction.model.tests.MInteractionTest.testSort(MInteractionTest.java:304)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at junit.framework.TestCase.runTest(TestCase.java:176)
    at junit.framework.TestCase.runBare(TestCase.java:141)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:252)
    at junit.framework.TestSuite.run(TestSuite.java:247)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:181)
    at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:43)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4577)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4186)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:52)
    at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:43)
    at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:46)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1472)```
planger commented 5 years ago

To mitigate this problem, I'll fix the seed to 1l for now, but we should look into this whether there is an actual issue buried below this random exception.

cdamus commented 5 years ago

No mitigation is required, @planger. I have fixed this in pull request #440 which you merged.

planger commented 5 years ago

Oh, right. I missed that. I'm closing this PR then.