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

Bug 375356

Summary: [BrowserHistory] exception on session timeout with SimpleLifeCycle
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: holger.staudacher
Version: 1.5   
Target Milestone: 1.5 M7   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Proposed patch none

Description Ralf Sternberg CLA 2012-03-26 15:05:14 EDT
2012-03-26 15:01:57.898:WARN:/rapdemo:ERROR:  Could not execute org.eclipse.rwt.internal.widgets.BrowserHistory.beforeDestroy(SessionStoreEvent).
java.lang.IllegalStateException: No context available outside of the request service lifecycle.
	at org.eclipse.rwt.internal.service.ContextProvider.getContext(ContextProvider.java:105)
	at org.eclipse.rwt.internal.application.ApplicationContextUtil.getInstance(ApplicationContextUtil.java:76)
	at org.eclipse.rwt.internal.application.RWTFactory.getLifeCycleFactory(RWTFactory.java:36)
	at org.eclipse.rwt.internal.widgets.BrowserHistory.beforeDestroy(BrowserHistory.java:144)
	at org.eclipse.rwt.internal.service.SessionStoreImpl.fireBeforeDestroy(SessionStoreImpl.java:243)
	at org.eclipse.rwt.internal.service.SessionStoreImpl.doValueUnbound(SessionStoreImpl.java:218)
	at org.eclipse.rwt.internal.service.SessionStoreImpl.access$0(SessionStoreImpl.java:212)
	at org.eclipse.rwt.internal.service.SessionStoreImpl$1.run(SessionStoreImpl.java:70)
	at org.eclipse.rwt.internal.lifecycle.SimpleLifeCycle$SimpleSessionShutdownAdapter.interceptShutdown(SimpleLifeCycle.java:96)
	at org.eclipse.rwt.internal.service.SessionStoreImpl.valueUnbound(SessionStoreImpl.java:182)
	at org.eclipse.jetty.server.session.AbstractSession.unbindValue(AbstractSession.java:489)
	at org.eclipse.jetty.server.session.AbstractSession.clearAttributes(AbstractSession.java:340)
	at org.eclipse.jetty.server.session.AbstractSession.doInvalidate(AbstractSession.java:307)
	at org.eclipse.jetty.server.session.HashedSession.doInvalidate(HashedSession.java:72)
	at org.eclipse.jetty.server.session.AbstractSession.timeout(AbstractSession.java:285)
	at org.eclipse.jetty.server.session.HashSessionManager.scavenge(HashSessionManager.java:309)
	at org.eclipse.jetty.server.session.HashSessionManager$2.run(HashSessionManager.java:274)
	at java.util.TimerThread.mainLoop(Timer.java:512)
	at java.util.TimerThread.run(Timer.java:462)
Comment 1 Holger Staudacher CLA 2012-04-03 12:20:34 EDT
This is also an important topic for us. Any workaround known?
Comment 2 Ivan Furnadjiev CLA 2012-04-03 12:25:59 EDT
Created attachment 213507 [details]
Proposed patch

This patch wraps the execution of shutdownCallback in a FakeContextUtil.runNonUIThreadWithFakeContext. Unfortunately, I didn't manage to create a JUnit test to reproduce the exception.
Comment 3 Ivan Furnadjiev CLA 2012-04-17 04:15:05 EDT
Created attachment 214085 [details]
Proposed patch

This patch includes the above fix + JUnit test.
Comment 4 Ivan Furnadjiev CLA 2012-04-17 04:35:59 EDT
... and probably we could wrap the code in SimpleLifeCycle#interceptShutdown in a single FakeContextUtil#runNonUIThreadWithFakeContext.
Comment 5 Ivan Furnadjiev CLA 2012-04-18 02:28:02 EDT
Applied patch to CVS with small re-factoring - use of single FakeContextUtil#runNonUIThreadWithFakeContext as proposed in comment#4.