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

Bug 331771

Summary: Livelock on startup
Product: [Eclipse Project] Platform Reporter: Jeff McAffer <jeffmcaffer>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: dj.houghton, lshanmug, markus.kell.r, remy.suen, skovatch
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Jeff McAffer CLA 2010-12-03 09:41:58 EST
using i1116 on the Mac Cocoa 64 I frequently get a livelock situation where one core is maxed out and Eclipse is hung.  It seems to happen when I launch eclipse and then do some manipulation in the workspace chooser.  there does not seem to be a particular pattern just sometimes while I'm selecting from the list of previous workspaces or driving through the file chooser (browse) it locks up.

It may be related that the console pretty much always (with or without hang) shows the following
java.lang.IllegalStateException: Workbench has not been created yet.
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
	at org.eclipse.ui.internal.ide.IDEWorkbenchPlugin$2.run(IDEWorkbenchPlugin.java:360)
	at org.eclipse.swt.widgets.Display.runTimers(Display.java:3922)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3434)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.ide.ChooseWorkspaceDialog.prompt(ChooseWorkspaceDialog.java:91)
	at org.eclipse.ui.internal.ide.application.IDEApplication.promptForWorkspace(IDEApplication.java:277)
	at org.eclipse.ui.internal.ide.application.IDEApplication.checkInstanceLocation(IDEApplication.java:225)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:105)
	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: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:621)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:576)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1409)
Comment 1 Jeff McAffer CLA 2010-12-03 09:46:45 EST
I've had some luck reproducing by starting Eclipse and then clicking the Browse button in the workspace chooser *before* that stack trace appears (seems like in the first 5 seconds or so).  The file chooser opens but then I get the lockup. 

I just tried another theory.  Start Eclipse and then drop down the previous workspace list and don't pick anything, just leave it dropped down.  When that timeout happens and the stacktrace appears, one core will get saturated.  I seem to be able to reproduce this all the time.
Comment 2 Remy Suen CLA 2010-12-03 10:09:02 EST
Please try upgrading to a newer build, Jeff.

*** This bug has been marked as a duplicate of bug 330373 ***
Comment 3 DJ Houghton CLA 2010-12-03 10:30:22 EST
I am able to reproduce this problem with the same build (i1116 32bit version) on my Mac. I start up Eclipse, open up the "previous workspace" drop down, don't select anything, wait a few (30?) seconds, (I actually went to another app and then back later) then you get the "beachball of death". (as Jeff refers to it :-)

I tried these steps with the 1130 i-build though and don't get the livelock.

I think the stack trace is a red herring. Maybe there was a change in SWT here? I *think* the drop-down remained open when I switched apps in the i1116 build but when I switch apps in the i1130 build it closes when losing focus.

Maybe someone in SWT can comment/close.
Comment 4 Markus Keller CLA 2010-12-03 10:42:09 EST
When you say "the drop-down", do you mean the sub-menu of "File > Switch Workspace", or do you mean the Combo in the "Switch Workspace > Others..." dialog?

If it's the former, then the problem could also be in Platform UI, near
bug 244316 comment 18 (but it's not that bug).
Comment 5 DJ Houghton CLA 2010-12-03 10:46:15 EST
I'm starting Eclipse from the command-line (not doing a switch workspace) so it is the combo/dropdown/thingie that allows me to choose a recently used workspace.
Comment 6 Scott Kovatch CLA 2010-12-03 12:11:15 EST
(In reply to comment #3)
> I am able to reproduce this problem with the same build (i1116 32bit version)
> on my Mac. I start up Eclipse, open up the "previous workspace" drop down,
> don't select anything, wait a few (30?) seconds, (I actually went to another
> app and then back later) then you get the "beachball of death". (as Jeff refers
> to it :-)
> 
> I tried these steps with the 1130 i-build though and don't get the livelock.
> 
> I think the stack trace is a red herring. Maybe there was a change in SWT here?
> I *think* the drop-down remained open when I switched apps in the i1116 build
> but when I switch apps in the i1130 build it closes when losing focus.

I've been doing some work with fixing focus saving/restoration lately, so it's very possible that I fixed this. See bug 330749. I just fixed it on 11/29, though, so I don't think it would have made it into an 11/30 I-build. I could be wrong, though.

The combo box should close when the window deactivates. Actually, just about any click that isn't on the combo box should hide the drop-down menu.
Comment 7 Scott Kovatch CLA 2010-12-06 15:11:00 EST
Jeff (or anyone else who can reproduce this), are you using Mac OS X 10.6 or 10.5.x? See bug 330345.
Comment 8 DJ Houghton CLA 2010-12-06 15:13:33 EST
I am using 10.6.5.
Comment 9 Jeff McAffer CLA 2010-12-06 16:13:57 EST
10.6.5 here too.  This does look like it could be a dupe of the other bug...
Comment 10 Scott Kovatch CLA 2010-12-06 16:39:50 EST
Aha! I think I just figured this out, looking at the native samples in 330345. Clicking outside the popup or switching to another application _should_ trigger something inside AppKit so that the combo box's popup window can be hidden. But when a Java exception is thrown JNI is basically hosed at that point, so no callbacks into the SWT will fire, including calls that AppKit is relying on to keep event dispatch going. So, we end up stuck in a tight loop.

Let me try to reproduce this again and I'll try to confirm the theory.
Comment 11 Jeff McAffer CLA 2010-12-06 17:00:50 EST
sounds promising.  I will just point out that I don't need to click outside.  Just drop down the combo.  My naive theory was that this triggers another event loop to manage the dropdown action and then the exception happens and ...  (as you say).  This is reproducible every time for me.
Comment 12 Scott Kovatch CLA 2010-12-06 17:15:52 EST
(In reply to comment #11)
> sounds promising.  I will just point out that I don't need to click outside. 
> Just drop down the combo.  My naive theory was that this triggers another event
> loop to manage the dropdown action and then the exception happens and ...  (as
> you say).  This is reproducible every time for me.

Yep, you are exactly right. Dropping down the combo box should be enough -- eventually a timer will fire and execute the offending line of code. The trick, I guess, is showing the combo box popup menu quickly enough to trigger it.
Comment 13 Eclipse Webmaster CLA 2019-09-06 15:31:56 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 14 Lakshmi P Shanmugam CLA 2020-06-25 01:38:51 EDT
Closing, please reopen if problem still happens with latest eclipse.