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

Bug 340742

Summary: NullPointerException after triggering a Quit action and refreshing page
Product: [RT] RAP Reporter: Elvis Dominguez <elvisd79>
Component: WorkbenchAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neubauer, ruediger.herrmann, timo.rohrberg
Version: 1.4   
Target Milestone: 1.5 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
project to reproduce none

Description Elvis Dominguez CLA 2011-03-23 07:35:05 EDT
Created attachment 191740 [details]
project to reproduce

attached the project
tested with eclipse 1.3.1, 1.3.2 and 1.4.0 M6
launch the application
select File > Exit
Refresh the Page

Expected: application's restart 
Instead : in the console I see an exception.


!ENTRY org.eclipse.rap.ui 4 0 2011-03-23 12:30:51.828
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.internal.menus.WorkbenchMenuService.<init>(WorkbenchMenuService.java:254)
	at org.eclipse.ui.internal.Workbench.initializeDefaultServices(Workbench.java:1874)
	at org.eclipse.ui.internal.Workbench.init(Workbench.java:1594)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2655)
	at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:702)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:685)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
	at test.rap.Application.createUI(Application.java:17)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManagerInstance.createUI(EntryPointManagerInstance.java:79)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:33)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:242)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:111)
	at java.lang.Thread.run(Thread.java:662)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
Comment 1 Elvis Dominguez CLA 2011-03-23 07:39:41 EDT
As side note this causing me serious issues.
deployed in jboss 5.1.0 (uses tomcat) gives me plenty of hanged sessions.
Comment 2 Elvis Dominguez CLA 2011-03-23 08:08:07 EDT
I have tried with RAP 1.2.2 and no exception is thrown!
Comment 3 Ivan Furnadjiev CLA 2011-03-24 08:25:25 EDT
I can reproduce it with your project and RAP from CVS HEAD too.
Comment 4 Ivan Furnadjiev CLA 2011-03-24 09:56:56 EDT
When Quit action is used, the workbench is closed and serviceLocator is disposed. But when the page is reloaded, Workbench#getInstance() returns old disposed workbench instead of creating a new one - working in the old session, ContextProvider.getSession() returns old session.
Comment 5 Ivan Furnadjiev CLA 2011-04-04 03:08:45 EDT
During the weekend I did some more investigation on this. The issue appears if you reload (F5) browser window after using Workbench#close(), but before session timeout. Looking into RWTLifeCycle#UIThreadController#run when the createUI exits, the uiThread.switchThread() should wait for session to timeout. Thus, the UIThreadTerminatedError that comes from reload will end up in the try/catch clause and will do the ISessionShutdownAdapter#processShutdown() which clear the session store. In our case, the uiThread.switchThread() exits immediately and session store is not cleared.
Comment 6 Ivan Furnadjiev CLA 2011-07-20 10:27:07 EDT
With current CVS HEAD the exception changes to:
java.lang.IllegalStateException: SingletonManager already installed for session: xk6a51gkihrr3uaw9spc5ebv
	at org.eclipse.rwt.internal.SingletonManager.checkNotInstalled(SingletonManager.java:70)
	at org.eclipse.rwt.internal.SingletonManager.install(SingletonManager.java:27)
	at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.clearSessionStore(LifeCycleServiceHandler.java:149)
	at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.checkRequest(LifeCycleServiceHandler.java:136)
	at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.runLifeCycle(LifeCycleServiceHandler.java:74)
	at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.synchronizedService(LifeCycleServiceHandler.java:57)
	at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.service(LifeCycleServiceHandler.java:46)
	at org.eclipse.rwt.internal.service.ServiceManager$HandlerDispatcher.service(ServiceManager.java:34)
	at org.eclipse.rwt.internal.engine.RWTDelegate.doPost(RWTDelegate.java:44)
	at org.eclipse.rwt.internal.engine.RWTDelegate.doGet(RWTDelegate.java:33)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.rap.rwt.osgi.internal.CutOffContextPathWrapper.service(CutOffContextPathWrapper.java:103)
	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
To reproduce, start Workbench Demo, select File -> Exit and refresh the page with F5.
Comment 7 RĂ¼diger Herrmann CLA 2011-10-17 18:14:41 EDT
With current CVS HEAD the exception changed to:

java.lang.NullPointerException: The parameter 'display' must not be null.
	at org.eclipse.rwt.internal.util.ParamCheck.notNull(ParamCheck.java:40)
	at org.eclipse.rwt.internal.protocol.ClientObjectFactory.getForDisplay(ClientObjectFactory.java:67)
	at org.eclipse.rwt.internal.textsize.TextSizeUtilFacadeImpl.callDisplayMethod(TextSizeUtilFacadeImpl.java:73)
	at org.eclipse.rwt.internal.textsize.TextSizeUtilFacadeImpl.writeStringMeasurementsInternal(TextSizeUtilFacadeImpl.java:57)
	at org.eclipse.rwt.internal.textsize.TextSizeUtilFacade.writeStringMeasurements(TextSizeUtilFacade.java:26)
	at org.eclipse.rwt.internal.textsize.MeasurementOperator.writeTextMeasurements(MeasurementOperator.java:128)
	at org.eclipse.rwt.internal.textsize.MeasurementOperator.handleMeasurementRequests(MeasurementOperator.java:46)
	at org.eclipse.rwt.internal.textsize.MeasurementListener.handleMeasurementRequests(MeasurementListener.java:56)
	at org.eclipse.rwt.internal.textsize.MeasurementListener.afterPhase(MeasurementListener.java:30)
	at org.eclipse.rwt.internal.lifecycle.PhaseListenerManager.notifyAfterPhase(PhaseListenerManager.java:85)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.continueLifeCycle(RWTLifeCycle.java:194)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:91)
	at java.lang.Thread.run(Unknown Source)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:101)
Comment 8 Ivan Furnadjiev CLA 2011-11-07 03:15:41 EST
The last exception has been fixed in CVS HEAD. With this fix no more exceptions are thrown after using Quit action and refreshing the page (F5). Please reopen if the issue persist.