Community
Participate
Working Groups
Created attachment 240417 [details] RCP app that sleeps forever I have code that calls display.wake() from another thread while the main loop is in a display.sleep(). It doesn't wake up. while (true) { if (!display.readAndDispatch()) { if (initDone[0]) break; System.err.println("sleep"); //$NON-NLS-1$ display.sleep(); System.err.println("get up"); //$NON-NLS-1$ } } With syserr logs I see the "sleep" and then I see the "wake" from the other thread display.wake() ... but I don't see the "get up" You an reproduce by importing the attached plugin, opening the plugin.xml, and Launch as an eclipse app. It stays asleep in org.eclipse.ui.application.WorkbenchAdvisor.openWindows(). PW
Hi Paul, Not able to reproduce this issue with the the attached plugin project. Also we don't see the display.sleep()/display.wake() calls in this code.
The wake/sleep calls that cause the problem for me are at org.eclipse.ui.application.WorkbenchAdvisor.openWindows() I'll re-test it with M6. PW
I can reproduce it easily on 4.4.0.I20140325-0830. But I believe it's related to thread timing, not display. PW
Changing the thread finally to below fixes the problem: initDone[0] = true; yield(); display.wake(); PW
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=2684e32f10bc6ffa91779f55073010c0846c5bff PW
I can still reproduce the problem. PW
This only happens to me with one of our test apps, so I'm deferring it. PW
*** Bug 435693 has been marked as a duplicate of this bug. ***
(In reply to Paul Webster from comment #4) > initDone[0] = true; > yield(); > display.wake(); from org.eclipse.ui.application.WorkbenchAdvisor.openWindows() while (true) { if (!display.readAndDispatch()) { if (initDone[0]) break; display.sleep(); } } even with a yield before the display.wake(), the above loop manages to hang in simple RCP cases. PW
https://git.eclipse.org/r/27235 I tried making the initDone volatile so that it must be checked by each thread. That worked for one invocation (I delete the workspace on each run) but then it went back to hanging. PW
https://git.eclipse.org/r/27236 Here's a change that seems to fix my problem consistently. The init thread spawns another thread that also has a display.wake() in it. If we get into the scenario where our yield();display.wake(); is not enough, the second display wake will fix it. If the original code works, the display wake is no-op. I don't like this fix. PW
https://git.eclipse.org/r/27238 This approach is hacky, deliberately adding 5 ms between the initDone=true and the display.wake(). But it worked on fixing my problem and without adding another (hacky) thread to the system. That makes it much more predictable. PW
Eric, can you please review comment #12 PW
+1 Component Lead. Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=ac1c494b688069a5a54c914fe1dbdcd1a4cf5fe3 PW
*** Bug 434967 has been marked as a duplicate of this bug. ***
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/182619