Bug 413571 - compare with base opens 2 editors
Summary: compare with base opens 2 editors
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-23 15:38 EDT by Sam Davis CLA
Modified: 2013-07-29 17:01 EDT (History)
2 users (show)

See Also:


Attachments
mylyn/context/zip (12.57 KB, application/octet-stream)
2013-07-25 04:45 EDT, Tomasz Zarna CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Davis CLA 2013-07-23 15:38:27 EDT
Clicking compare with base opens the compare editor twice and leaves the following in the log:

org.eclipse.swt.SWTException: Failed to execute runnable (java.util.ConcurrentModificationException)
	at org.eclipse.swt.SWT.error(SWT.java:4361)
	at org.eclipse.swt.SWT.error(SWT.java:4276)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
	at java.util.ArrayList$Itr.next(ArrayList.java:791)
	at org.eclipse.mylyn.reviews.core.spi.remote.emf.RemoteEmfConsumer$ConsumerAdapter.notifyChanged(RemoteEmfConsumer.java:81)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:98)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:86)
	at org.eclipse.mylyn.reviews.core.spi.remote.emf.RemoteEmfConsumer.applyModel(RemoteEmfConsumer.java:252)
	at org.eclipse.mylyn.reviews.core.spi.remote.JobRemoteService$2$1.run(JobRemoteService.java:77)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	... 23 more
Comment 1 Sam Davis CLA 2013-07-23 15:57:37 EDT
I don't know why this started happening today, but it happens every time.
Comment 2 Tomasz Zarna CLA 2013-07-24 07:40:12 EDT
Review: https://git.eclipse.org/r/#/c/14802
Comment 3 Steffen Pingel CLA 2013-07-24 11:36:37 EDT
From the review in the context of RemoteEmfConsumer:

It appears that almost all access to remoteEmfObservers is synchronized. I don't see any need to make it a CopyOnWriteArrayList. 

That said, I think it's the better choice than synchronizing access. The latter is particularly problematic since the lock is held while observers are notified which can easily lead to dead locks. I don't know what the intended semantics are so it's hard to say if removing the synchronized statement would be correct but it would at least remove the risk of deadlocks.So... let's make that change *and* remove all synchronized blocks around remoteEmfObservers.

Miles?
Comment 4 Tomasz Zarna CLA 2013-07-25 04:45:29 EDT
In the latest patch set I removed synchronized blocks for remoteEmfObservers and dispose the compare UI observer directly. This seems to be working fine.
Comment 5 Tomasz Zarna CLA 2013-07-25 04:45:34 EDT
Created attachment 233785 [details]
mylyn/context/zip
Comment 6 Sam Davis CLA 2013-07-25 12:33:08 EDT
Tomek, were you able to reproduce the issue?
Comment 7 Tomasz Zarna CLA 2013-07-25 15:23:32 EDT
(In reply to comment #6)
> Tomek, were you able to reproduce the issue?

Yes, and I can confirm it's gone with the latest patch applied.
Comment 8 Tomasz Zarna CLA 2013-07-26 12:04:16 EDT
Fixed in 2925fa0c6e1f4c9ecf45d65acc3e4cd64f429e78
Comment 9 Miles Parker CLA 2013-07-29 15:05:39 EDT
(In reply to comment #3)
> From the review in the context of RemoteEmfConsumer:
> 
> It appears that almost all access to remoteEmfObservers is synchronized. I don't
> see any need to make it a CopyOnWriteArrayList.
> 
> That said, I think it's the better choice than synchronizing access. The latter
> is particularly problematic since the lock is held while observers are notified
> which can easily lead to dead locks. I don't know what the intended semantics
> are so it's hard to say if removing the synchronized statement would be correct
> but it would at least remove the risk of deadlocks.So... let's make that change
> *and* remove all synchronized blocks around remoteEmfObservers.
> 
> Miles?

Yeah, I'm afraid that this probably *wasn't* the way to go. :D See bug 413480 comment 1. Generally, when you start playing around w/ synchronization issues in this way in EMF, you're really just playing Whack-A-Mole. We have to get at the root cause. I'm going to reopen as when we fix bug 413480, we'll still need a decent fix for this one.
Comment 10 Steffen Pingel CLA 2013-07-29 17:01:13 EDT
I'm marking this as resolved until we have indication that the fix has caused a problem. The change did not cause the problem in 413480.