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

Bug 326577

Summary: No activeWorkbenchWindow found while executing org.eclipse.ui.perspectives.showPerspective (intermittant error)
Product: [Eclipse Project] Platform Reporter: Miwako Tokugawa <miwako.tokugawa>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: pwebster
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Miwako Tokugawa CLA 2010-09-29 14:58:26 EDT
Build Identifier: M20100909-0800

1. download and untar eclipse-SDK-3.6.1-linux-gtk.tar.gz
2. start eclipse by 
./eclipse -clean -data ../workspace -showlocation -vmargs -Xmx708M 
3. Window->Open Perspective
 -> sometimes this succeeds. somethme nothing happens and I get the following in .log. At such times, "File->Exit" also becomes nonresponsive and I can't exit Eclipse.
org.eclipse.core.commands.ExecutionException: No activeWorkbenchWindow found while executing org.eclipse.ui.perspectives.showPerspective
        at org.eclipse.ui.handlers.HandlerUtil.noVariableFound(HandlerUtil.java:40)
        at org.eclipse.ui.handlers.HandlerUtil.getVariableChecked(HandlerUtil.java:89)
        at org.eclipse.ui.handlers.HandlerUtil.getActiveWorkbenchWindowChecked(HandlerUtil.java:210)
        at org.eclipse.ui.handlers.ShowPerspectiveHandler.execute(ShowPerspectiveHandler.java:47)
        at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
        at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
        at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:178)
        at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)
        at org.eclipse.ui.actions.PerspectiveMenu.runOther(PerspectiveMenu.java:376)
        at org.eclipse.ui.actions.PerspectiveMenu$3.runWithEvent(PerspectiveMenu.java:130)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
        at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
        at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
        at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
        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:369)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1407)


Reproducible: Sometimes
Comment 1 Miwako Tokugawa CLA 2010-09-29 15:00:21 EDT
mtokugaw-desk 34>java -version
java version "1.6.0_17"
OpenJDK Runtime Environment (IcedTea6 1.7.4) (rhel-1.21.b17.el6-i386)
OpenJDK Server VM (build 14.0-b16, mixed mode)
mtokugaw-desk 34>which java
/usr/bin/java
mtokugaw-desk 35>uname -a
Linux mtokugaw-desk 2.6.32-71.el6.i686 #1 SMP Wed Sep 1 01:26:34 EDT 2010 i686 i686 i386 GNU/Linux
Comment 2 Miwako Tokugawa CLA 2010-09-29 15:41:17 EDT
I see the same error when I use eclipse-SDK-3.6RC4-linux-gtk (instead of eclipse-SDK-3.6.1-linux-gtk) and java 1.5(jrockit-R27.1.0-jdk1.5.0_08). I haven't seen the error on EL5 so far.
nhxlc200 10>uname -a
Linux nhxlc200 2.6.18-8.el5PAE #1 SMP Fri Jan 26 14:28:43 EST 2007 i686 i686 i386 GNU/Linux
Comment 3 Miwako Tokugawa CLA 2010-09-30 00:36:45 EDT
I tried this on another system that has the identical OS
Linux anothersystem 2.6.32-71.el6.i686 #1 SMP Wed Sep 1 01:26:34 EDT 2010 i686 i686 i386 GNU/Linux
and can not reproduce this problem.
In case you can't either, any clue on what may be wrong (with the system) would be helpful.
Comment 4 Paul Webster CLA 2010-09-30 07:36:01 EDT
(In reply to comment #3)
> In case you can't either, any clue on what may be wrong (with the system) would
> be helpful.

Things that can effect your particular case:

Are you running a Sun VM on the second system?  I see that you could still reproduce the problem with the JRocket VM on the first system.

Are the graphics libraries exactly the same?  gtk2? are you using the same version of the same window manager (like metacity) on both boxes?  Are you running a desktop manager on one but not the other. Or have you changed things like the mouse policy (focus follows mouse, for example)?

If SWT doesn't get shell activation events, that can lose active window instructions.

I can't reproduce the problem here, but I'm on RHEL 5.

PW
Comment 5 Miwako Tokugawa CLA 2010-09-30 12:14:23 EDT
Hi. Thank you for taking a look.
> Are you running a Sun VM on the second system?  I see that you could still
> reproduce the problem with the JRocket VM on the first system.
Yes. 

> Are the graphics libraries exactly the same?  gtk2? 
They are slightly different. "rpm -qa | grep ^gtk2" returns

On the bad system
gtk2-engines-2.18.4-5.el6.i686
gtk2-devel-docs-2.18.9-4.el6.i686
gtk2-immodule-xim-2.18.9-4.el6.i686 <= only here
gtk2-2.18.9-4.el6.i686
gtk2-devel-2.18.9-4.el6.i686

On the good system
gtk2-2.18.6-2.el6.i686 <= only here
gtk2-devel-docs-2.18.9-4.el6.i686
gtk2-engines-2.18.4-5.el6.i686
gtk2-2.18.9-4.el6.i686
gtk2-devel-2.18.9-4.el6.i686

> are you using the same version of the same window manager (like metacity) on both boxes?  Are you unning a desktop manager on one but not the other. 
BIG difference here.
On the good system, GNOME is run. I access the system using VNC viewer. I then do Applications->Accessories->Terminal to open a terminal window and start the eclipse from the command line. It also runs Nautilus 2.30.0.
On the bad system, no manager seems to be run. I access the system using VNC viewer the, and the VNC window shows a single terminal window. I start the eclipse from the command line there.

> Or have you changed things
> like the mouse policy (focus follows mouse, for example)?
No
Comment 6 Paul Webster CLA 2010-09-30 12:31:32 EDT
(In reply to comment #5)
> On the bad system, no manager seems to be run. I access the system using VNC
> viewer the, and the VNC window shows a single terminal window. I start the
> eclipse from the command line there.

OK, this is the difference that matters.  The window manager plays a big roll in providing shell activation events/focus events.  SWT needs a window manager to be present.   Without that, we won't correctly activate/deactivate the WorkbenchWindow.


Even when we run our headless tests against Xvnc or Xvfb, we must start a window manager like:
Xvfb :8 -screen 0 1280x1024x24 -auth auth.cfg &
DISPLAY=:8.0 metacity --display=:8.0 --replace --sm-disable >/dev/null 2>&1 &

You need  to start a window manager of some kind on that system (even twm should provide some more stability).

You can post back to this bug if this helps/doesn't help you.

PW
Comment 7 Miwako Tokugawa CLA 2010-09-30 13:39:14 EDT
Hi.
Thank you very much for help!
I changed my .vnc/xstartup to start gnome, and now run eclipse from it. And the error seems to have gone away (well at least for now. :-))