Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367820 - [Compatibility] NPE opening editor
Summary: [Compatibility] NPE opening editor
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 4.2 M6   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 366990 367844
  Show dependency tree
 
Reported: 2012-01-04 05:04 EST by Ed Willink CLA
Modified: 2012-02-10 09:34 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2012-01-04 05:04:22 EST
I have some Xtext editor smoke tests that work as JUnit Plugin tests on Windows and Eclipse 3.8, but fail on Hudson with e4. The NPE seems to resemble bug 343907.

org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:838)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:110)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:80)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.inject(ContextInjectionFactory.java:72)
	at org.eclipse.ui.internal.Workbench.createWorkbenchWindow(Workbench.java:1231)
	at org.eclipse.ui.internal.Workbench.getActiveWorkbenchWindow(Workbench.java:1205)
	at org.eclipse.ocl.examples.test.xtext.EditorTests.doTestEditor(EditorTests.java:61)
	at org.eclipse.ocl.examples.test.xtext.EditorTests.testEditor_OpenCompleteOCLEditor(EditorTests.java:72)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:999)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:893)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:91)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:575)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:530)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:41)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
	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:352)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1433)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1409)
Caused by: java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3312)
	at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:530)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	... 59 more
Comment 1 Paul Webster CLA 2012-01-04 07:28:05 EST
What happens on Windows on 4.2?

PW
Comment 2 Remy Suen CLA 2012-01-04 08:35:03 EST
(In reply to comment #0)
> Caused by: java.lang.NullPointerException
>     at
> org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3312)
>     at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:530)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
>     ... 59 more

Odd place to fail. I'd have expected another error that precedes this one.

Which build of Eclipse 4.x are you testing with?
Comment 3 Ed Willink CLA 2012-01-04 10:58:12 EST
(In reply to comment #2)
> Which build of Eclipse 4.x are you testing with?

The Buckminster scripts look like their after

<rm:uri format="{0}/eclipse/updates/4.2-I-builds">

The Hudson workspace contains

https://hudson.eclipse.org/hudson/job/buckminster-mdt-ocl-branch-tests/ws/buildroot/target.platform/plugins/org.eclipse.e4.core.di_1.1.0.v20111221-1333.jar
Comment 4 Remy Suen CLA 2012-01-11 13:33:46 EST
Does this NPE occur if you are using Eclipse regularly or only when the tests are being run?
Comment 5 Ed Willink CLA 2012-01-11 13:44:51 EST
Just checked with 4.2M4 interactively; no apparent problem.

Problem is for JUnit plugin tests on Hudson.
Comment 6 Remy Suen CLA 2012-01-11 14:18:36 EST
(In reply to comment #5)
> Problem is for JUnit plugin tests on Hudson.

So they only fail when running on Hudson? Where can I get the source code for these tests?
Comment 7 David Williams CLA 2012-01-11 14:34:23 EST
Also, you say 
"JUnit Plugin tests on Windows
and Eclipse 3.8" 
was that on Hudson? 

If Hudson only (for 3.8, or 4.2) I'd be sure to remind you that a "display" is needed on Hudson ... I think most people specify this by checking "Run Xvnc during build" ... but suspect you, Ed, know this. Just reminding, just in case.
Comment 8 Ed Willink CLA 2012-01-11 14:41:19 EST
The failing build was
https://hudson.eclipse.org/hudson/job/buckminster-mdt-ocl-branch-tests/63/

The sources are all in: http://git.eclipse.org/c/mdt/org.eclipse.ocl.git.

The tests are:
tests\org.eclipse.ocl.examples.xtext.tests\src\org\eclipse\ocl\examples\test\xtext\EditorTests.java
Comment 9 Remy Suen CLA 2012-01-11 14:45:13 EST
(In reply to comment #7)
> If Hudson only (for 3.8, or 4.2) I'd be sure to remind you that a "display" is
> needed on Hudson ... I think most people specify this by checking "Run Xvnc
> during build" ... but suspect you, Ed, know this. Just reminding, just in case.

I do see an error in the Hudson log complaining about a display.

---------

Standard Error

Xlib:  extension "RANDR" missing on display ":12.0".

(In reply to comment #8)
> The failing build was
> https://hudson.eclipse.org/hudson/job/buckminster-mdt-ocl-branch-tests/63/

The log is filled with errors complaining about EventAdmin. Can you ensure that the org.eclipse.equinox.event bundle is available to your build while it's running the tests?

!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-01-04 04:48:49.631
!MESSAGE Event Admin service is not available, unable to publish event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/menu/ToolBarContributions/toolBarContributions/UNKNOWN].
Comment 10 Ed Willink CLA 2012-01-11 14:59:02 EST
(In reply to comment #7)
> Also, you say 
> "JUnit Plugin tests on Windows
> and Eclipse 3.8" 
> was that on Hudson? 
> 
> If Hudson only (for 3.8, or 4.2) I'd be sure to remind you that a "display" is
> needed on Hudson ... I think most people specify this by checking "Run Xvnc
> during build" ... but suspect you, Ed, know this. Just reminding, just in case.

I suspect that there's something subtle here.

The log file starts with

04/01/2012 04:34:49 Xvnc version X.org/xf4vnc custom version
04/01/2012 04:34:49 Copyright (C) 2001-2004 Alan Hourihane.
...

and ends with

Terminating xvnc.

But after the problem tests there is another

04/01/2012 04:48:50 Xvnc version X.org/xf4vnc custom version
04/01/2012 04:48:50 Copyright (C) 2001-2004 Alan Hourihane.
...

Perhaps this means that Xvnc is not running during the problem tests.

Perhaps my releng can shed some light on why Xvnc gets triggered half way
through.

However if the problem is a bad device, a DI NPE doesn't seem like a good
diagnostic.
Comment 11 Ed Willink CLA 2012-01-11 15:13:01 EST
(In reply to comment #9)
> I do see an error in the Hudson log complaining about a display.
 
> Xlib:  extension "RANDR" missing on display ":12.0".
> 
> !ENTRY org.eclipse.e4.ui.workbench 4 0 2012-01-04 04:48:49.631
> !MESSAGE Event Admin service is not available, unable to publish event

I cannot find any "RANDR" or "MESSAGE" in https://hudson.eclipse.org/hudson/job/buckminster-mdt-ocl-branch-tests/63/consoleFull

If an Event Admin is needed shouldn't it be there already?

How do we add it?

There are many non-error errors in Hudson/Buckminster/Athena logs so it is difficult to know what matters....

Could not init font path element /usr/share/fonts/TTF/, removing from list!
Could not init font path element /usr/share/fonts/OTF, removing from list!
Comment 12 David Williams CLA 2012-01-11 15:13:01 EST
(In reply to comment #9)
> 
> I do see an error in the Hudson log complaining about a display.
> 
> ---------
> 
> Standard Error
> 
> Xlib:  extension "RANDR" missing on display ":12.0".
> 

That error is pretty normal ... more of a "warning" if you need RANR (which you don't, as far as I know ... "resize and rotate"). 

> But after the problem tests there is another
> 
> 04/01/2012 04:48:50 Xvnc version X.org/xf4vnc custom version
> 04/01/2012 04:48:50 Copyright (C) 2001-2004 Alan Hourihane.
> ...
> 
> Perhaps this means that Xvnc is not running during the problem tests.
> 
> Perhaps my releng can shed some light on why Xvnc gets triggered half way
> through.
> 

I think I've raised a Red Herring ... if there is a "display" at all (and you
have shown there is) you should be fine in that regard. Maybe some bundle not
installed, as Remy suggests?
Comment 13 Remy Suen CLA 2012-01-11 16:10:19 EST
(In reply to comment #11)
> (In reply to comment #9)
> > I do see an error in the Hudson log complaining about a display.
> 
> > Xlib:  extension "RANDR" missing on display ":12.0".
> > 
> > !ENTRY org.eclipse.e4.ui.workbench 4 0 2012-01-04 04:48:49.631
> > !MESSAGE Event Admin service is not available, unable to publish event
> 
> I cannot find any "RANDR" or "MESSAGE" in
> https://hudson.eclipse.org/hudson/job/buckminster-mdt-ocl-branch-tests/63/consoleFull

I was looking at the test failure's logs.

> If an Event Admin is needed shouldn't it be there already?

This is your standard API problem. The interface is available, it's that an implementation is not (the org.eclipse.equinox.event bundle).
Comment 14 Ed Willink CLA 2012-01-11 16:48:40 EST
(In reply to comment #13)
> I was looking at the test failure's logs.
> 
> > If an Event Admin is needed shouldn't it be there already?
> 
> This is your standard API problem. The interface is available, it's that an
> implementation is not (the org.eclipse.equinox.event bundle).

org.eclipse.pde.build is reported as missing and is indeed missing from the workspace.

It looks like we're missing some Hudson/Buckminster configuration magic to enable the UI parts of the platform to load.
Comment 15 Paul Webster CLA 2012-01-12 08:22:06 EST
(In reply to comment #7)
> If Hudson only (for 3.8, or 4.2) I'd be sure to remind you that a "display" is
> needed on Hudson ... I think most people specify this by checking "Run Xvnc
> during build" ... but suspect you, Ed, know this. Just reminding, just in case.

I'll just add that you also need to have a useful Window Manager running within your display for automated UI tests to do something useful (SWT depends on WM events).  We use metacity on build.eclipse.org:

metacity --replace --sm-disable

But based on further comments it sounds like a configuration issue, so you might have that already running.

PW
Comment 16 Ed Willink CLA 2012-01-30 15:17:29 EST
(In reply to comment #15)
> I'll just add that you also need to have a useful Window Manager running within
> your display for automated UI tests to do something useful (SWT depends on WM
> events).  We use metacity on build.eclipse.org:
> 
> metacity --replace --sm-disable
> 
> But based on further comments it sounds like a configuration issue, so you
> might have that already running.

I don't think we have metacity so I think the onus is on us. I've added the MDT/OCL releng.
Comment 17 Adolfo Sanchez-Barbudo Herrera CLA 2012-01-31 04:12:56 EST
(In reply to comment #14)
> (In reply to comment #13)
> > I was looking at the test failure's logs.
> > 
> > > If an Event Admin is needed shouldn't it be there already?
> > 
> > This is your standard API problem. The interface is available, it's that an
> > implementation is not (the org.eclipse.equinox.event bundle).
> 
> org.eclipse.pde.build is reported as missing and is indeed missing from the
> workspace.
> 
> It looks like we're missing some Hudson/Buckminster configuration magic to
> enable the UI parts of the platform to load.

If such a plugin with the interface implementation is required, can't the test plugin  simply depend on that plugin, then buckminster would automatically install it in the target platform ?.

(In reply to comment #15)
> I'll just add that you also need to have a useful Window Manager running within
> your display for automated UI tests to do something useful (SWT depends on WM
> events).  We use metacity on build.eclipse.org:
> 
> metacity --replace --sm-disable
> 
> But based on further comments it sounds like a configuration issue, so you
> might have that already running.
> 
> PW

No idea about what metacity is ;P... I'll have to google it for info.

Cheers,
Adolfo.
Comment 18 Ed Willink CLA 2012-01-31 04:26:27 EST
(In reply to comment #17)
> > metacity --replace --sm-disable
> > 
 No idea about what metacity is ;P... I'll have to google it for info.

One of the cross-project-dev observations on initial slave5 testing was that metacity wasn't installed; so I guess it is installed on fully functional Hudson.

I suspect we just add the metacity line to a shell/startup script.
Comment 19 Eric Moffatt CLA 2012-02-08 16:14:30 EST
Is this still an issue ?

Is it an issue that we can help with or is it a config issue on Hudson ?
Comment 20 Adolfo Sanchez-Barbudo Herrera CLA 2012-02-09 05:23:44 EST
Hi Eric,

I think that the ball is in our roof. Yesterday, I wanted to try the metacity command in our tests job, however Eclipse servers are not helping to verify the solution.

Let's see if we are luckier along the day.

Regards,
Adolfo.
Comment 21 Adolfo Sanchez-Barbudo Herrera CLA 2012-02-10 08:33:19 EST
Ok,

I've just confirmed that the option makes the offending tests (and the job) work [1]. Resolving as Invalid.

BTW, I've noticed the following message when terminating xvnc:

"Window manager warning: Fatal IO error 11 (Resource temporarily unavailable) on display ':10'." 

Paul, do you have any extra information/guide about this ?

[1] https://hudson.eclipse.org/hudson/job/buckminster-mdt-ocl-branch-tests/81/

Cheers,
Adolfo.
Comment 22 Paul Webster CLA 2012-02-10 08:39:51 EST
(In reply to comment #21)
> 
> "Window manager warning: Fatal IO error 11 (Resource temporarily unavailable)
> on display ':10'." 
> 
> Paul, do you have any extra information/guide about this ?
> 

I've never seen that one myself.  Since it says "temp" then if it is not interfering with the tests I'd ignore it (but my experience here is lacking).

PW
Comment 23 Adolfo Sanchez-Barbudo Herrera CLA 2012-02-10 09:34:48 EST
(In reply to comment #22)
> (In reply to comment #21)
> >
> > "Window manager warning: Fatal IO error 11 (Resource temporarily unavailable)
> > on display ':10'."
> >
> > Paul, do you have any extra information/guide about this ?
> >
> 
> I've never seen that one myself.  Since it says "temp" then if it is not
> interfering with the tests I'd ignore it (but my experience here is lacking).
> 
> PW

I'll (temporarily) do it ;)

Thanks,
Adolfo.