Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ModalContext deadlock(Using ModalContext.run() before UISynchonizer.started() causes deadlock)
ModalContext deadlock [message #850659] Fri, 20 April 2012 08:01 Go to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi everybody,
while porting my RCP application to RAP i came over the following problem. In the process of View creation I sometimes have to access data from a database. The access is performed by a Loader class that - in some cases - uses a ModalContext. Now I found out that usage of the ModalContext causes a deadlock if running on the RAP platform. It perfectly works on RCP.

The reason is the following code in UISynchronizer which is reached because of condition isStarting:

synchronized (this) {
			// the following block should not be invoked if we're using 3.2 threading.
			if (isStarting && !use32Threading && startupThread.get() == Boolean.FALSE
					&& overrideThread.get() == Boolean.FALSE) {
				do {
					try {
						this.wait();
					} catch (InterruptedException e) {
					}
				} while (isStarting);
			}
		}


I have found a thread in the rap-dev mailinglist:

http://dev.eclipse.org/mhonarc/lists/rap-dev/msg00466.html

Also a bug that seems to be related:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=280829


But I can't find out if this is still an known/open issue or if it is a related bug.

I am using RAP 1.4.2 target platform

Regards
Thorsten
Re: ModalContext deadlock [message #851799 is a reply to message #850659] Sat, 21 April 2012 10:15 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Thorsten,

Which RAP version are you using?

There has been a deadlock problem with ModalContext with a workaround
that is applicable for RAP, too. Please check out bug 314222 and see if
it relates to your problem.

Regards, Ralf

[1] 314222: Deadlock in ModalContext before Workbench window opened
https://bugs.eclipse.org/bugs/show_bug.cgi?id=314222

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: ModalContext deadlock [message #853740 is a reply to message #851799] Mon, 23 April 2012 09:37 Go to previous message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi Ralf,
thanks for pointing me to that bug. From the first glance it seems to be the same issue. I am using RAP 1.4.2. As far as I understand, the workaround is to set a preference that results in using Eclispe 3.2 threading. Since I am not sure about the consequences I worked around the problem by not using ModalContext if the workbench is not completely initialized.

if (PlatformUI.getWorkbench().isStarting()|| ModalContext.isModalContextThread(Thread.currentThread()))
{
   queryExecuter.excecuteInForeground(null);
}
else
{
   try {
	ModalContext.run(new IRunnableWithProgress() {
         .......
   } 
   catch (Exception e)
   {
         ....
   }
}



Regards,
Thorsten
Previous Topic:Error validating warproduct
Next Topic:Rounded corners in Browser Widget (IE9)
Goto Forum:
  


Current Time: Tue Apr 23 06:44:33 GMT 2024

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

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

Back to the top