Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Splash screen freezes often in application based on Eclipse
Splash screen freezes often in application based on Eclipse [message #498337] Mon, 16 November 2009 14:13 Go to next message
Gabriel Erzse is currently offline Gabriel Erzse
Messages: 6
Registered: November 2009
Junior Member
Hi,

I've posted this into the Newcomers section, but I got no response there, just an advice to post it here too. So here it is.

With Ecplise I'm developing a solution that shows a splash screen on start. When I start my solution, sometimes (about 1 out of 10 times) the splash screen freezes indefinitely. The workaround is to generate any UI event on the splash screen, for example move the mouse over it, or even hit ALT-TAB to make it loose focus.

I've tried remote debugging and managed to get the stacktraces of the threads while the splash screen is frozen. You can find them attached in a text file.

I've also looked in the code, and it seems the problem appears in the Workbench class, in the runUI() method. There is this piece of code (around line 3000 in Workbench class):

Thread initThread = new Thread() {
/* (non-Javadoc)
 * @see java.lang.Thread#run()
 */
public void run() {
	try {
		//declare us to be a startup thread so that our syncs will be executed 
		UISynchronizer.startupThread.set(Boolean.TRUE);
		initOK[0] = Workbench.this.init();
	} 
	catch (Throwable e) {
		error[0] = e;
	} 
	finally {
		initDone[0] = true;
		display.wake();
	}
}};
initThread.start();
while (true) {
	if (!display.readAndDispatch()) {
		if (initDone[0])
			break;
		display.sleep();
	}
}


The Workbench.this.init() call ends up into a Display.syncExec() call, which puts a RunnableLock into the message queue. The RunnableLock should be executed later by the display.readAndDispatch() call. The parent thread blocks at a OS.WaitMessage() call, while the child thread blocks at a RunnableLock.wait() call.

If I generate any UI event, it must wake up the display thread, and then the RunnableLock gets executed and everything moves on nicely.

The build id of the Eclipse I'm using is 20090619-0625. It's an Eclipse RCP. The problem seems generic to me, but I can provide more details about versions if anyone thinks it helps.

If anybody has any ideas how to fix this problem, I would appreciate it.

Thanks,
Gabi.
Re: Splash screen freezes often in application based on Eclipse [message #498340 is a reply to message #498337] Mon, 16 November 2009 14:16 Go to previous messageGo to next message
Gabriel Erzse is currently offline Gabriel Erzse
Messages: 6
Registered: November 2009
Junior Member
And the stack trace capture:

[5:51:35 PM] ...: Java HotSpot(TM) Client VM[192.168.0.183:1044] (Suspended) 
 Daemon System Thread [Attach Listener] (Suspended) 
 Daemon System Thread [Signal Dispatcher] (Suspended) 
 Daemon System Thread [Finalizer] (Suspended) 
  waiting for: ReferenceQueue$Lock  (id=98) 
  Object.wait(long) line: not available [native method] 
  ReferenceQueue<T>.remove(long) line: 116 
  ReferenceQueue<T>.remove() line: 132 
  Finalizer$FinalizerThread.run() line: 159 
 Daemon System Thread [Reference Handler] (Suspended) 
  waiting for: Reference$Lock  (id=99) 
  Object.wait(long) line: not available [native method] 
  Reference$Lock(Object).wait() line: 485 
  Reference$ReferenceHandler.run() line: 116 
 Thread [main] (Suspended) 
  OS.WaitMessage() line: not available [native method] 
  Display.sleep() line: 4281 
  Workbench.runUI() line: 2319 
  Workbench.access$4(Workbench) line: 2221 
  Workbench$5.run() line: 500 
  Realm.runWithDefault(Realm, Runnable) line: 332 
  Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 493 
  PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 
  IDEApplication.start(IApplicationContext) line: 113 
  EclipseAppHandle.run(Object) line: 194 
  EclipseAppLauncher.runApplication(Object) line: 110 
  EclipseAppLauncher.start(Object) line: 79 
  EclipseStarter.run(Object) line: 368 
  EclipseStarter.run(String[], Runnable) line: 179 
  NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] 
  NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 
  DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 
  Method.invoke(Object, Object...) line: 597 
  Main.invokeFramework(String[], URL[]) line: 559 
  Main.basicRun(String[]) line: 514 
  Main.run(String[]) line: 1311 
  Main.main(String[]) line: 1287 
 Thread [State Saver] (Suspended) 
  waiting for: SystemState  (id=90) 
  Object.wait(long) line: not available [native method] 
  BaseStorage$StateSaver.run() line: 1190 
  Thread.run() line: 619 
 Daemon Thread [Framework Event Dispatcher] (Suspended) 
  waiting for: EventManager$EventThread  (id=20) 
  Object.wait(long) line: not available [native method] 
  EventManager$EventThread(Object).wait() line: 485 
  EventManager$EventThread.getNextEvent() line: 386 
  EventManager$EventThread.run() line: 326 
 Daemon Thread [Start Level Event Dispatcher] (Suspended) 
  waiting for: EventManager$EventThread  (id=23) 
  Object.wait(long) line: not available [native method] 
  EventManager$EventThread(Object).wait() line: 485 
  EventManager$EventThread.getNextEvent() line: 386 
  EventManager$EventThread.run() line: 326 
 Daemon Thread [Bundle File Closer] (Suspended) 
  waiting for: EventManager$EventThread  (id=24) 
  Object.wait(long) line: not available [native method] 
  EventManager$EventThread(Object).wait() line: 485 
  EventManager$EventThread.getNextEvent() line: 386 
  EventManager$EventThread.run() line: 326 
 Thread [Worker-0] (Suspended) 
  waiting for: WorkerPool  (id=89) 
  Object.wait(long) line: not available [native method] 
  WorkerPool.sleep(long) line: 185 
  WorkerPool.startJob(Worker) line: 217 
  Worker.run() line: 51 
 Daemon System Thread [Java2D Disposer] (Suspended) 
  waiting for: ReferenceQueue$Lock  (id=97) 
  Object.wait(long) line: not available [native method] 
  ReferenceQueue<T>.remove(long) line: 116 
  ReferenceQueue<T>.remove() line: 132 
  Disposer.run() line: 125 
  Thread.run() line: 619 
 Daemon Thread [AWT-Windows] (Suspended) 
  WToolkit.eventLoop() line: not available [native method] 
  WToolkit.run() line: 291 
  Thread.run() line: 619 
 Thread [Thread-4] (Suspended) 
  waiting for: RunnableLock  (id=95) 
  Object.wait(long) line: not available [native method] 
  RunnableLock(Object).wait() line: 485 
  UISynchronizer(Synchronizer).syncExec(Runnable) line: 186 
  UISynchronizer.syncExec(Runnable) line: 150 
  Display.syncExec(Runnable) line: 4312 
  StartupThreading.runWithoutExceptions(StartupThreading$StartupRunnable) line: 94 
  Workbench.initializeDefaultServices() line: 1595 
  Workbench.init() line: 1341 
  Workbench.access$32(Workbench) line: 1296 
  Workbench$58.run() line: 2304 
 Daemon Thread [TaskExecuter[0]] (Suspended) 
  waiting for: TaskThreadPool$MyCallback  (id=92) 
  Object.wait(long) line: not available [native method] 
  TaskThreadPool$MyCallback(Object).wait() line: 485 
  TaskExecuter.run() line: 66 
  Thread.run() line: 619 
 Daemon Thread [MessagePreHandler] (Suspended) 
  waiting for: ArrayList<E>  (id=96) 
  Object.wait(long) line: not available [native method] 
  ArrayList<E>(Object).wait() line: 485 
  ClientMessagePreQueueHandler.run() line: 141 
  Thread.run() line: 619 
 Daemon Thread [MessageScheduler] (Suspended) 
  waiting for: TreeSet<E>  (id=94) 
  Object.wait(long) line: not available [native method] 
  ClientManager$Scheduler.run() line: 888 
  Thread.run() line: 619 
 Daemon Thread [PingScanner] (Suspended) 
  waiting for: TreeSet<E>  (id=93) 
  Object.wait(long) line: not available [native method] 
  ClientManager$PingScanner.run() line: 676 
  Thread.run() line: 619 
 Thread [pool-1-thread-1] (Suspended) 
  Unsafe.park(boolean, long) line: not available [native method] 
  LockSupport.parkNanos(Object, long) line: 198 
  AbstractQueuedSynchronizer$ConditionObject.awaitNanos(long) line: 1963 
  DelayQueue<E>.take() line: 164 
  ScheduledThreadPoolExecutor$DelayedWorkQueue.take() line: 583 
  ScheduledThreadPoolExecutor$DelayedWorkQueue.take() line: 576 
  ScheduledThreadPoolExecutor(ThreadPoolExecutor).getTask() line: 947 
  ThreadPoolExecutor$Worker.run() line: 907 
  Thread.run() line: 619 
 Thread [scheduler_Worker-0] (Suspended) 
  waiting for: Object  (id=91) 
  Object.wait(long) line: not available [native method] 
  SimpleThreadPool.getNextRunnable() line: 428 
  SimpleThreadPool.access$000(SimpleThreadPool) line: 47 
  SimpleThreadPool$WorkerThread.run() line: 518 
 Thread [scheduler_QuartzSchedulerThread] (Suspended) 
  Thread.sleep(long) line: not available [native method] 
  QuartzSchedulerThread.run() line: 394 
 Daemon Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (Suspended) 
  Thread.sleep(long) line: not available [native method] 
  ContainerBase$ContainerBackgroundProcessor.run() line: 1579 
  Thread.run() line: 619 
 Daemon Thread [http-8080-Acceptor-0] (Suspended) 
  owns: SocksSocketImpl  (id=88) 
  PlainSocketImpl.socketAccept(SocketImpl) line: not available [native method] 
  SocksSocketImpl(PlainSocketImpl).accept(SocketImpl) line: 384 
  ServerSocket.implAccept(Socket) line: 453 
  ServerSocket.accept() line: 421 
  DefaultServerSocketFactory.acceptSocket(ServerSocket) line: 61 
  JIoEndpoint$Acceptor.run() line: 317 
  Thread.run() line: 619
Re: Splash screen freezes often in application based on Eclipse [message #498374 is a reply to message #498337] Mon, 16 November 2009 16:26 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
Last time I used Display.syncExec in startup it didn't work either. See
this blog how i solved threading by then [1] (Read the comment section
it holds extra information)

Tom

[1] http://tomsondev.bestsolution.at/2007/06/12/splash-screen-an d-threads/

Gabriel Erzse schrieb:
> Hi,
>
> I've posted this into the Newcomers section, but I got no response
> there, just an advice to post it here too. So here it is.
>
> With Ecplise I'm developing a solution that shows a splash screen on
> start. When I start my solution, sometimes (about 1 out of 10 times) the
> splash screen freezes indefinitely. The workaround is to generate any UI
> event on the splash screen, for example move the mouse over it, or even
> hit ALT-TAB to make it loose focus.
>
> I've tried remote debugging and managed to get the stacktraces of the
> threads while the splash screen is frozen. You can find them attached in
> a text file.
>
> I've also looked in the code, and it seems the problem appears in the
> Workbench class, in the runUI() method. There is this piece of code
> (around line 3000 in Workbench class):
>
> Thread initThread = new Thread() {
> /* (non-Javadoc)
> * @see java.lang.Thread#run()
> */
> public void run() {
> try {
> //declare us to be a startup thread so that our syncs will be
> executed UISynchronizer.startupThread.set(Boolean.TRUE);
> initOK[0] = Workbench.this.init();
> } catch (Throwable e) {
> error[0] = e;
> } finally {
> initDone[0] = true;
> display.wake();
> }
> }};
> initThread.start();
> while (true) {
> if (!display.readAndDispatch()) {
> if (initDone[0])
> break;
> display.sleep();
> }
> }
>
>
> The Workbench.this.init() call ends up into a Display.syncExec() call,
> which puts a RunnableLock into the message queue. The RunnableLock
> should be executed later by the display.readAndDispatch() call. The
> parent thread blocks at a OS.WaitMessage() call, while the child thread
> blocks at a RunnableLock.wait() call.
>
> If I generate any UI event, it must wake up the display thread, and then
> the RunnableLock gets executed and everything moves on nicely.
>
> The build id of the Eclipse I'm using is 20090619-0625. It's an Eclipse
> RCP. The problem seems generic to me, but I can provide more details
> about versions if anyone thinks it helps.
>
> If anybody has any ideas how to fix this problem, I would appreciate it.
>
> Thanks,
> Gabi.
>
Previous Topic:RCP Stop execution of Runnable
Next Topic:Aesthetic toolbar in Mac
Goto Forum:
  


Current Time: Sat Oct 25 13:00:15 GMT 2014

Powered by FUDForum. Page generated in 0.01642 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software