Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 506709

Summary: 3 BindingPersistenceTest/s fail sometimes with an error on Linux GTK+
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, bsd, ericwill, gautier.desaintmartinlacaze, kalyan_prasad, Lars.Vogel, lufimtse, psuzzi
Version: 4.7   
Target Milestone: 4.8 M5   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/112590
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4ea150c1052dd3505ee52065f12b61f4aac6bc6a
https://git.eclipse.org/r/115198
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=576add7b9412e040d6a0ee654bc720a3d2a82294
Whiteboard:
Attachments:
Description Flags
Image: tests are running on windows none

Description Dani Megert CLA 2016-10-28 09:38:22 EDT
I20161027-0700.

The following 3 3 BindingPersistenceTest/s failed sometimes in the past builds:
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x


http://download.eclipse.org/eclipse/downloads/drops4/I20161026-1100/testresults/html/org.eclipse.ui.tests_ep47I-unit-lin64_linux.gtk.x86_64_8.0.html


N/A

junit.framework.AssertionFailedError
at org.eclipse.ui.tests.keys.BindingPersistenceTest.testAboutBindingEmacs(BindingPersistenceTest.java:439)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:754)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:351)
at org.eclipse.test.UITestApplication$2.run(UITestApplication.java:192)
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:4500)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4113)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1133)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:698)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
at org.eclipse.test.UITestApplication.runApplication(UITestApplication.java:138)
at org.eclipse.test.UITestApplication.run(UITestApplication.java:60)
at org.eclipse.test.UITestApplication.start(UITestApplication.java:207)
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 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)
at org.eclipse.core.launcher.Main.main(Main.java:34)
Comment 1 Patrik Suzzi CLA 2016-11-01 06:19:41 EDT
Created attachment 265129 [details]
Image: tests are running on windows

I just tested and I add some observations: 

1. Tests are running in Windows with "Run As > JUnit Plug-in Test", see attached image
2. Tests are failing on finding a perfect binding for "F12" and "ALT+R", see below:


Here you can see the three failure points in tests:

testAboutBinding(BindingPersistenceTest.java:315)

	final KeySequence keyF12 = Util.isMac() ? KeySequence.getInstance("M1+F12") : KeySequence.getInstance("F12");
	final Binding editorBinding = bindingService.getPerfectMatch(keyF12);
	assertNotNull(editorBinding); // fail


testAboutBindingIn3x(BindingPersistenceTest.java:388)

	final KeySequence keyF12 = Util.isMac() ?  KeySequence.getInstance("M1+F12") : KeySequence.getInstance("F12");
	final Binding editorBinding = bindingService.getPerfectMatch(keyF12);
	assertNotNull(editorBinding); // fail


testAboutBindingEmacs(BindingPersistenceTest.java:439)

	final KeySequence keyAltR = KeySequence.getInstance("ALT+R");
	final Binding findAndReplaceBinding = bindingService.getPerfectMatch(keyAltR);
	assertNotNull(findAndReplaceBinding); // fail
Comment 2 Dani Megert CLA 2017-01-20 05:13:02 EST
They constantly failed in the last few builds.

NOTE: They only fail on GTK+ 2.
Comment 3 Lars Vogel CLA 2017-03-03 03:49:40 EST
Mass move. Please move back to M6, if necessary
Comment 4 Dani Megert CLA 2017-05-12 10:32:00 EDT
Please set a target milestone again when you plan to fix the bug.
Comment 5 Dani Megert CLA 2017-07-26 08:21:12 EDT
Failed on GTK+ 2 and GTK+ 3:
http://download.eclipse.org/eclipse/downloads/drops4/I20170725-2000/testResults.php
Comment 6 Brian de Alwis CLA 2017-08-15 16:30:49 EDT
I've been able to reproduce this when running the tests under Docker with Xvnc.  Basically, there's a race condition where the tests assume that a IWorkbenchWindow is properly activated so that the appropriate binding contexts are set.  The test failures doesn't always happen.  And I've occasionally seen a failure where all BindingPersistenceTest tests fail with NPEs as the retrieved IBindingService is always null — here I can see that the window hasn't even become visible!

This error happens when I run with and without a window manager.  

In the case where only the testAboutBinding* tests fail, the IBindingService's EBindingService's contextSet holds only a single context:

   org.eclipse.ui.contexts.dialogAndWindow

whereas we normally have 11 contexts:

   org.eclipse.ui.contexts.dialogAndWindow
   org.eclipse.ui.NavigateActionSetresource
   org.eclipse.ui.actionSet.keyBindings
   org.eclipse.ui.actionSet.openFiles
   org.eclipse.ui.cheatsheets.actionSet
   org.eclipse.ui.contexts.window
   org.eclipse.ui.edit.text.actionSet.annotationNavigation
   org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo
   org.eclipse.ui.edit.text.actionSet.navigation
   org.eclipse.ui.tests.actionSet125011
   org.eclipse.ui.tests.actionSets.brokenActionSet
   org.eclipse.ui.tests.markers

The other tests in BindingPersistenceTest succeed as they use COPY, PASTE, or REDO, which are all defined in org.eclipse.ui.contexts.dialogAndWindow.

I thought I would try opening a test window for each of the tests by adding a doSetUp() to BindingPersistenceTest:

	protected void doSetUp() throws Exception {
		openTestWindow();
	}

but that leads to all sorts of test failures due to an NPE as there is no IServiceLocatorCreator service available!

Caused by: java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:507)
	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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	... 60 more


So the question is really: why are the tests starting on GTK before the window is fully activated?  I don't see this on OS X.
Comment 7 Dani Megert CLA 2017-08-21 03:32:46 EDT
(In reply to Brian de Alwis from comment #6)
> So the question is really: why are the tests starting on GTK before the
> window is fully activated?  I don't see this on OS X.

Can anyone working on GTK+ have a look?
Comment 8 Leo Ufimtsev CLA 2017-08-21 11:03:08 EDT
Can someone clarify, is this a regression of sorts? Any rough timeline when this started happening?
Comment 9 Kalyan Prasad Tatavarthi CLA 2017-08-24 04:22:01 EDT
M20170823-1700

The following 3 BindingPersistenceTest/s failed in the above build 
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x

The failure seems to be happening intermittently.
Comment 10 Kalyan Prasad Tatavarthi CLA 2017-08-31 09:00:35 EDT
M20170830-1700

The following 3 BindingPersistenceTest/s failed in the above build 
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x
Comment 11 Kalyan Prasad Tatavarthi CLA 2017-10-26 07:28:27 EDT
Build I20171025-2000

The following 3 BindingPersistenceTest/s failed in the above build 
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x
Comment 12 Kalyan Prasad Tatavarthi CLA 2017-11-09 05:48:30 EST
Build M20171108-1700

The following 3 BindingPersistenceTest/s failed in the above build 
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x
Comment 13 Dani Megert CLA 2017-11-09 11:37:55 EST
(In reply to Leo Ufimtsev from comment #8)
> Can someone clarify, is this a regression of sorts? Any rough timeline when
> this started happening?

You can see it dates back to 2016, so, not very useful. Someone just needs to take a look. It happens quite often lately.
Comment 14 Kalyan Prasad Tatavarthi CLA 2017-11-16 05:49:41 EST
Build M20171115-1700

The following 3 BindingPersistenceTest/s failed in the above build 
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x
Comment 15 Kalyan Prasad Tatavarthi CLA 2017-11-24 03:37:16 EST
Build M20171122-1700

The following 3 BindingPersistenceTest/s failed in the above build 
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x
Comment 16 Eclipse Genie CLA 2017-11-29 14:12:51 EST
New Gerrit change created: https://git.eclipse.org/r/112590
Comment 17 Kalyan Prasad Tatavarthi CLA 2017-11-30 23:48:45 EST
Build M20171130-0510

The following 3 BindingPersistenceTest/s failed in the above build 
- testAboutBindingEmacs
- testAboutBinding
- testAboutBindingIn3x
Comment 19 Alexander Kurtakov CLA 2017-12-12 06:09:17 EST
Haven't failed lately after Lucas's changes. Resolving.
Comment 20 Eclipse Genie CLA 2018-01-10 15:38:03 EST
New Gerrit change created: https://git.eclipse.org/r/115198