Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » UIThreadTerminatedError on session timeout
UIThreadTerminatedError on session timeout [message #674166] Thu, 26 May 2011 01:23 Go to next message
Ryan Donnelly is currently offline Ryan DonnellyFriend
Messages: 35
Registered: July 2009
Member
Hi,
We have a complex single-sourced RAP/RCP application that we will be
deploying on Tomcat with RAP 1.4 (probably an RC build - we can't wait
for June 22) in about a month. We have deployed on a small scale with
earlier versions of RAP (principally 1.2.1).

We have always used a timeout and SessionStoreListener to do our own
cleanup if the user closes the browser. However, with RAP 1.4 (I am
running against latest from CVS), we are having difficulty getting a
timeout. See my post from earlier today for the UICallBack angle:

http://www.eclipse.org/forums/index.php/mv/msg/210174/674051/#msg_674051

The problem here is the following:

I have tried four methods to register a listener that should be called
on timeout:

SessionStoreListener (the method that used to work for us)

Display.disposeExec()

Display.addListener(SWT.Dispose, ...

Display.addListener(SWT.Close, ...


If I trigger a timeout at the end of createUI(), after I've deactivated
UICallBack, like this:

RWT.getRequest().getSession().setMaxInactiveInterval(1);

I can successfully get the first three listeners to be called (not the
SWT.Close listener however).

However, if a timeout occurs from closing the browser, leaving the
browser idle, navigating to a new page, etc., the timeout occurs, but
instead of calling my listeners, I get the following exception. This is
true in Jetty or in Tomcat, and even if I never activate UICallBack:


org.eclipse.rwt.internal.lifecycle.UIThread$UIThreadTerminatedError
at
org.eclipse.rwt.internal.lifecycle.UIThread.handleInterruptInSwitchThread(UIThread.java:92)
at
org.eclipse.rwt.internal.lifecycle.UIThread.switchThread(UIThread.java:63)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.sleep(RWTLifeCycle.java:266)
at org.eclipse.swt.widgets.Display.sleep(Display.java:1162)
at com.lti.swtutils.DispatchLoop.readAndDispatch(DispatchLoop.java:38)
at com.lti.gui.AppImpl.run(AppImpl.java:1551)
at com.lti.rwt.WebApp.createUI(WebApp.java:285)
at
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:73)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:213)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:90)
at java.lang.Thread.run(Unknown Source)
at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)


Examining the RAP code:

RWTLifeCycle$UIThreadController.run() - we want to get to the catch
block below - this is the only place where we can shutdown from (and
therefore call SessionStoreListener.beforeDestroy()):


private final class UIThreadController implements Runnable {
public void run() {
...
// In any case: wait for the thread to be terminated by
session timeout
uiThread.switchThread();
} catch( UIThreadTerminatedError e ) {
// If we get here, the session is being invalidated, see
// UIThread#terminateThread()
( ( ISessionShutdownAdapter )uiThread ).processShutdown();
}

The problem is that in our case, we are in UIThread.switchThread() from
RWTLifeCycle.sleep(), which exits immediately when
UIThread.switchThread() gets its InterruptedException and its
handleInterruptInSwitchThread() throws UIThreadTerminatedError.



A similar situation is described in Ivan Furnadjiev's comment 5 to this bug:

#340742 NullPointerException after triggering a Quit action and
refreshing page
https://bugs.eclipse.org/bugs/show_bug.cgi?id=340742



I would like to know, please:

1) Do you consider this problem the same as bug 340742, and, if so, is
bug 340742 likely to be fixed in 1.4?

2) Do you have any other suggested way of receiving a session timeout?


Thanks,

Ryan
Re: UIThreadTerminatedError on session timeout [message #674207 is a reply to message #674166] Thu, 26 May 2011 06:49 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Ryan,
could you please create a small project/snippet to reproduce the
problem. Please open a new bugzilla and attach the snippet there. We
will have a look on it as soon as possible. We are too late to fix the
bug 340742 for 1.4 release as it is in very sensitive area and need to
be investigated with care.
Best,
Ivan

On 5/26/2011 4:23 AM, Ryan Donnelly wrote:
> Hi,
> We have a complex single-sourced RAP/RCP application that we will
> be deploying on Tomcat with RAP 1.4 (probably an RC build - we can't
> wait for June 22) in about a month. We have deployed on a small scale
> with earlier versions of RAP (principally 1.2.1).
>
> We have always used a timeout and SessionStoreListener to do our
> own cleanup if the user closes the browser. However, with RAP 1.4 (I
> am running against latest from CVS), we are having difficulty getting
> a timeout. See my post from earlier today for the UICallBack angle:
>
> http://www.eclipse.org/forums/index.php/mv/msg/210174/674051/#msg_674051
>
> The problem here is the following:
>
> I have tried four methods to register a listener that should be
> called on timeout:
>
> SessionStoreListener (the method that used to work for us)
>
> Display.disposeExec()
>
> Display.addListener(SWT.Dispose, ...
>
> Display.addListener(SWT.Close, ...
>
>
> If I trigger a timeout at the end of createUI(), after I've
> deactivated UICallBack, like this:
>
> RWT.getRequest().getSession().setMaxInactiveInterval(1);
>
> I can successfully get the first three listeners to be called (not the
> SWT.Close listener however).
>
> However, if a timeout occurs from closing the browser, leaving the
> browser idle, navigating to a new page, etc., the timeout occurs, but
> instead of calling my listeners, I get the following exception. This
> is true in Jetty or in Tomcat, and even if I never activate UICallBack:
>
>
> org.eclipse.rwt.internal.lifecycle.UIThread$UIThreadTerminatedError
> at
> org.eclipse.rwt.internal.lifecycle.UIThread.handleInterruptInSwitchThread(UIThread.java:92)
>
> at
> org.eclipse.rwt.internal.lifecycle.UIThread.switchThread(UIThread.java:63)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.sleep(RWTLifeCycle.java:266)
>
> at org.eclipse.swt.widgets.Display.sleep(Display.java:1162)
> at
> com.lti.swtutils.DispatchLoop.readAndDispatch(DispatchLoop.java:38)
> at com.lti.gui.AppImpl.run(AppImpl.java:1551)
> at com.lti.rwt.WebApp.createUI(WebApp.java:285)
> at
> org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:73)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:213)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:90)
>
> at java.lang.Thread.run(Unknown Source)
> at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
>
>
> Examining the RAP code:
>
> RWTLifeCycle$UIThreadController.run() - we want to get to the catch
> block below - this is the only place where we can shutdown from (and
> therefore call SessionStoreListener.beforeDestroy()):
>
>
> private final class UIThreadController implements Runnable {
> public void run() {
> ...
> // In any case: wait for the thread to be terminated by
> session timeout
> uiThread.switchThread();
> } catch( UIThreadTerminatedError e ) {
> // If we get here, the session is being invalidated, see
> // UIThread#terminateThread()
> ( ( ISessionShutdownAdapter )uiThread ).processShutdown();
> }
>
> The problem is that in our case, we are in UIThread.switchThread()
> from RWTLifeCycle.sleep(), which exits immediately when
> UIThread.switchThread() gets its InterruptedException and its
> handleInterruptInSwitchThread() throws UIThreadTerminatedError.
>
>
>
> A similar situation is described in Ivan Furnadjiev's comment 5 to
> this bug:
>
> #340742 NullPointerException after triggering a Quit action and
> refreshing page
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=340742
>
>
>
> I would like to know, please:
>
> 1) Do you consider this problem the same as bug 340742, and, if so, is
> bug 340742 likely to be fixed in 1.4?
>
> 2) Do you have any other suggested way of receiving a session timeout?
>
>
> Thanks,
>
> Ryan
>
Re: UIThreadTerminatedError on session timeout [message #674376 is a reply to message #674207] Thu, 26 May 2011 17:03 Go to previous message
Ryan Donnelly is currently offline Ryan DonnellyFriend
Messages: 35
Registered: July 2009
Member
Ivan,
Thanks, I have figured out what this was, not a RAP problem at all. In
my exception handler that I had registered with
Window.setExceptionHandler(), I was not re-throwing ThreadDeath, like
Window$DefaultExceptionHandler does, so that it never got back to the
RWTLifeCycle$UIThreadController.run() catch block that calls
processShutdown().

This solves half of my problem with the timeouts. The other half, from
my other posting yesterday, remains, and some idea there would be very
helpful.

http://www.eclipse.org/forums/index.php/mv/msg/210174/674051/#msg_674051


Thanks,

Ryan



On 26/05/2011 03:49, Ivan Furnadjiev wrote:
> Hi Ryan,
> could you please create a small project/snippet to reproduce the
> problem. Please open a new bugzilla and attach the snippet there. We
> will have a look on it as soon as possible. We are too late to fix the
> bug 340742 for 1.4 release as it is in very sensitive area and need to
> be investigated with care.
> Best,
> Ivan
>
> On 5/26/2011 4:23 AM, Ryan Donnelly wrote:
>> Hi,
>> We have a complex single-sourced RAP/RCP application that we will be
>> deploying on Tomcat with RAP 1.4 (probably an RC build - we can't wait
>> for June 22) in about a month. We have deployed on a small scale with
>> earlier versions of RAP (principally 1.2.1).
>>
>> We have always used a timeout and SessionStoreListener to do our own
>> cleanup if the user closes the browser. However, with RAP 1.4 (I am
>> running against latest from CVS), we are having difficulty getting a
>> timeout. See my post from earlier today for the UICallBack angle:
>>
>> http://www.eclipse.org/forums/index.php/mv/msg/210174/674051/#msg_674051
>>
>> The problem here is the following:
>>
>> I have tried four methods to register a listener that should be called
>> on timeout:
>>
>> SessionStoreListener (the method that used to work for us)
>>
>> Display.disposeExec()
>>
>> Display.addListener(SWT.Dispose, ...
>>
>> Display.addListener(SWT.Close, ...
>>
>>
>> If I trigger a timeout at the end of createUI(), after I've
>> deactivated UICallBack, like this:
>>
>> RWT.getRequest().getSession().setMaxInactiveInterval(1);
>>
>> I can successfully get the first three listeners to be called (not the
>> SWT.Close listener however).
>>
>> However, if a timeout occurs from closing the browser, leaving the
>> browser idle, navigating to a new page, etc., the timeout occurs, but
>> instead of calling my listeners, I get the following exception. This
>> is true in Jetty or in Tomcat, and even if I never activate UICallBack:
>>
>>
>> org.eclipse.rwt.internal.lifecycle.UIThread$UIThreadTerminatedError
>> at
>> org.eclipse.rwt.internal.lifecycle.UIThread.handleInterruptInSwitchThread(UIThread.java:92)
>>
>> at
>> org.eclipse.rwt.internal.lifecycle.UIThread.switchThread(UIThread.java:63)
>>
>> at
>> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.sleep(RWTLifeCycle.java:266)
>>
>> at org.eclipse.swt.widgets.Display.sleep(Display.java:1162)
>> at com.lti.swtutils.DispatchLoop.readAndDispatch(DispatchLoop.java:38)
>> at com.lti.gui.AppImpl.run(AppImpl.java:1551)
>> at com.lti.rwt.WebApp.createUI(WebApp.java:285)
>> at
>> org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:73)
>>
>> at
>> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:213)
>>
>> at
>> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:90)
>>
>> at java.lang.Thread.run(Unknown Source)
>> at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
>>
>>
>> Examining the RAP code:
>>
>> RWTLifeCycle$UIThreadController.run() - we want to get to the catch
>> block below - this is the only place where we can shutdown from (and
>> therefore call SessionStoreListener.beforeDestroy()):
>>
>>
>> private final class UIThreadController implements Runnable {
>> public void run() {
>> ...
>> // In any case: wait for the thread to be terminated by session timeout
>> uiThread.switchThread();
>> } catch( UIThreadTerminatedError e ) {
>> // If we get here, the session is being invalidated, see
>> // UIThread#terminateThread()
>> ( ( ISessionShutdownAdapter )uiThread ).processShutdown();
>> }
>>
>> The problem is that in our case, we are in UIThread.switchThread()
>> from RWTLifeCycle.sleep(), which exits immediately when
>> UIThread.switchThread() gets its InterruptedException and its
>> handleInterruptInSwitchThread() throws UIThreadTerminatedError.
>>
>>
>>
>> A similar situation is described in Ivan Furnadjiev's comment 5 to
>> this bug:
>>
>> #340742 NullPointerException after triggering a Quit action and
>> refreshing page
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=340742
>>
>>
>>
>> I would like to know, please:
>>
>> 1) Do you consider this problem the same as bug 340742, and, if so, is
>> bug 340742 likely to be fixed in 1.4?
>>
>> 2) Do you have any other suggested way of receiving a session timeout?
>>
>>
>> Thanks,
>>
>> Ryan
>>
Previous Topic:Missing Border.js in qooxdoo sources since RAP 1.3M7
Next Topic:Middle click on editor tab to close the editor
Goto Forum:
  


Current Time: Fri Apr 26 19:22:29 GMT 2024

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

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

Back to the top