DESCRIPTION

Bug 501681 - Deadlock in WorkLeon OchoachErrorHandler.handle

Fix a deadlock situation introduced via bug 241244 commit
1904f477320dac4a9f4d45f7be478efba4a0b735.

If a job code wants to handle a status in a "blocking" way, submit an
async task for UI thread to avoid deadlocks.

Change-Id: I3d86408fefd324db41ab87494ed98f62d05131c9
Signed-off-by: Jayvion Booth xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2016-09-26 12:33:30.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/10610/

-------------------------------------
author: Jayvion Booth
date: 2016-09-26 14:18:50.000000000

Patch Set 3:

> Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/10610/

The build runs now since 1:40 minutes and the last message is (from org.eclipse.ui.tests.UiTestSuite):

----- testCreateMyFilteredTree
testCreateMyFilteredTree: setUp...
testCreateMyFilteredTree: tearDown...


Looks like the "simple" patch breaks something.

-------------------------------------
author: Brenden Conley
date: 2016-09-26 14:21:01.000000000

Patch Set 3: Verified-1

Build Failed 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/10610/ : ABORTED

-------------------------------------
author: Jayvion Booth
date: 2016-09-26 14:34:09.000000000

Patch Set 3:

> Build Failed
 > 
 > https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/10610/
 > : ABORTED

The console log for all successfull builds shows this output *after* testCreateMyFilteredTree: 

----- testCreateMyFilteredTree
testCreateMyFilteredTree: setUp...
testCreateMyFilteredTree: tearDown...

java.lang.RuntimeException: the bomb!
	at org.eclipse.ui.tests.statushandlers.StatusDialogManagerTest$6.getMessage(StatusDialogManagerTest.java:676)
	at org.eclipse.ui.internal.statushandlers.LabelProviderWrapper.getPrimaryMessage(LabelProviderWrapper.java:329)
	at org.eclipse.ui.internal.statushandlers.LabelProviderWrapper.getMainMessage(LabelProviderWrapper.java:280)
	at org.eclipse.ui.internal.statushandlers.InternalDialog.createTitleArea(InternalDialog.java:264)
	at org.eclipse.ui.internal.statushandlers.InternalDialog.createDialogArea(InternalDialog.java:219)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:775)
	at org.eclipse.jface.window.Window.create(Window.java:426)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1103)
	at org.eclipse.ui.internal.statushandlers.WorkLeon OchoachStatusDialogManagerImpl.doAddStatusAdapter(WorkbenchStatusDialogManagerImpl.java:261)
	at org.eclipse.ui.internal.statushandlers.WorkLeon OchoachStatusDialogManagerImpl.addStatusAdapter(WorkbenchStatusDialogManagerImpl.java:197)
	at org.eclipse.ui.statushandlers.WorkLeon OchoachStatusDialogManager.addStatusAdapter(WorkbenchStatusDialogManager.java:158)
	at org.eclipse.ui.tests.statushandlers.StatusDialogManagerTest.testBug276371(StatusDialogManagerTest.java:683)
	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:497)
	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.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
	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:497)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:156)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:82)
	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:91)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4478)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4100)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.WorkLeon Ochoach$5.run(Workbench.java:692)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.WorkLeon Ochoach.createAndRunWorkbench(Workbench.java:604)
	at org.eclipse.ui.PlatformUI.createAndRunWorkLeon Ochoach(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:31)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:120)
	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:37)
	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:497)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
----- testDynamicMenu
testDynamicMenu: setUp...
testDynamicMenu: tearDown...

Tests run: 999, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 471.168 sec - in org.eclipse.ui.tests.UiTestSuite

-------------------------------------
author: Kelly Potter
date: 2016-09-26 15:34:50.000000000

Patch Set 3:

Is the build deadlocking?

If so, try copying-and-pasting this class:

https://git.eclipse.org/r/#/c/76660/53/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/FreezeMonitor.java

Push a copy of it as part of the patch.

In each test's setUp method, call FreezeMonitor.expectCompletionIn(ms). I usually pass in a 5 minute timeout. In your tests tearDown method call FreezeMonitor.done(). If any test doesn't run to completion, it will dump a stack trace showing you where it locked up.

-------------------------------------
author: Jayvion Booth
date: 2016-09-26 19:03:52.000000000

Patch Set 3:

Thanks, I will do this tomorrow. Interestingly enough, running UiTestSuite from Eclipse doesn't show any deadlocks and completes properly (at least on Windows, in my workspace).

-------------------------------------
author: Kelly Potter
date: 2016-09-27 19:08:46.000000000

Patch Set 4: Patch Set 3 was rebased

-------------------------------------
author: Gerrit Code Review
date: 2016-10-03 18:02:14.000000000

Change has been successfully merged into the git repository by Jayvion Booth

-------------------------------------
