Community
Participate
Working Groups
Hi! I recently ran into a ConcurrentModificationException while using Ecore editor, but I really don't remember the steps, sorry :-/ I probably was doing something like moving an opened .ecore file into another project or something ... See the stacktrace below: eclipse.buildId=I20080617-2000 java.version=1.6.0_07 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_EN Framework arguments: -nl en_EN Command-line arguments: -os win32 -ws win32 -arch x86 -nl en_EN -data e:\workspaces\workspace_paprika Error Mon Aug 11 08:54:06 CEST 2008 Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench". java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(Unknown Source) at java.util.AbstractList$Itr.next(Unknown Source) at org.eclipse.emf.ecore.presentation.EcoreEditor.handleChangedResources(EcoreEditor.java:635) at org.eclipse.emf.ecore.presentation.EcoreEditor.handleActivate(EcoreEditor.java:612) at org.eclipse.emf.ecore.presentation.EcoreEditor$1.partActivated(EcoreEditor.java:353) at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:72) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:880) at org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57) at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:70) at org.eclipse.ui.internal.PartService.firePartActivated(PartService.java:186) at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:305) at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:56) at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:126) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3491) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:610) at org.eclipse.ui.internal.WorkbenchPage.showEditor(WorkbenchPage.java:2906) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2806) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729) at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721) at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2643) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:646) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:605) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:318) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:160) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:207) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:363) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$5.open(PackageExplorerPart.java:603) at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:820) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:880) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:818) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1079) at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1183) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:263) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:257) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:297) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
oops, bad bugzilla component...
Created attachment 111348 [details] Potential fix This fix would really need to go in the template. The only problem I can imagine is that a background thread is processing a resource delta while the foreground thread is processing the effects to a previous delta. The background thread could be populating changedResources while the foreground thread is iterating over it. With the changes in this patch, the changedResources and removedResources collections are changed only on the display thread, which should make the above scenario impossible... I'll think about it some more...
Created attachment 111987 [details] Changes to the editor template These are the corresponding changes for the template itself. We'll need to regenerate other editors as well.
Ed, this seems good as psychic debugging goes. One potential problem seems to be that savedResources could still be modified from a background thread (in doSave() via a WorkspaceModifyOperation), but I don't know if that could actually be a really problem.
I don't think that the workspace modify operation doing the doSave can be started while a resource delta is being processed. The operation will blog until the last workspace modify operation completes.
Ah, that makes sense. I'm fine with this being committed.
The changes have been committed to CVS for 2.5
Fix available in HEAD: 2.5.0M4 (S200812151800).
Fix available in HEAD: 2.5.0 (R200906151043).