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

Bug 566314

Summary: java.lang.IllegalStateException: Unable to read the json message on page reload under Internet Explorer 11
Product: [RT] RAP Reporter: Benjamin Brandl <Benjamin.Brandl>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan
Version: 3.12   
Target Milestone: 3.14 M3   
Hardware: PC   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=560514
https://git.eclipse.org/r/c/rap/org.eclipse.rap/+/168133
https://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=8a518b8a362e5ad2de9e86c75df42134062fe164
Whiteboard:

Description Benjamin Brandl CLA 2020-08-24 04:57:34 EDT
Since RAP 3.12 I'm seeing exception "java.lang.IllegalStateException: Unable to read the json message" everytime when reloading the applications start page under Internet Explorer 11.

The full stack trace is:

ERROR [qtp930329769-37]
java.lang.IllegalStateException: Unable to read the json message
	at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.readRequestMessage(LifeCycleServiceHandler.java:110)
	at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.processUIRequest(LifeCycleServiceHandler.java:88)
	at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.synchronizedService(LifeCycleServiceHandler.java:75)
	at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.service(LifeCycleServiceHandler.java:66)
	at org.eclipse.rap.rwt.engine.RWTServlet.handleValidRequest(RWTServlet.java:135)
	at org.eclipse.rap.rwt.engine.RWTServlet.handleRequest(RWTServlet.java:117)
	at org.eclipse.rap.rwt.engine.RWTServlet.doPost(RWTServlet.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.rap.rwt.osgi.internal.CutOffContextPathWrapper.service(CutOffContextPathWrapper.java:106)
	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyServlet.service(HttpServiceRuntimeImpl.java:1447)
	at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:159)
	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:54)
	at com.company.httpservice.filter.HSTSFilter.doFilter(HSTSFilter.java:24)
	at org.eclipse.equinox.http.registry.internal.FilterManager$FilterWrapper.doFilter(FilterManager.java:176)
	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyFilterFactory$LegacyFilter.doFilter(HttpServiceRuntimeImpl.java:1406)
	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:128)
	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:48)
	at com.company.httpservice.filter.CookieFilter.doFilter(CookieFilter.java:22)
	at org.eclipse.equinox.http.registry.internal.FilterManager$FilterWrapper.doFilter(FilterManager.java:176)
	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyFilterFactory$LegacyFilter.doFilter(HttpServiceRuntimeImpl.java:1406)
	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:128)
	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:48)
	at com.company.httpservice.filter.CacheControlFilter.doFilter(CacheControlFilter.java:25)
	at org.eclipse.equinox.http.registry.internal.FilterManager$FilterWrapper.doFilter(FilterManager.java:176)
	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyFilterFactory$LegacyFilter.doFilter(HttpServiceRuntimeImpl.java:1406)
	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:128)
	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:48)
	at com.company.httpservice.filter.TraceFilter.doFilter(TraceFilter.java:25)
	at org.eclipse.equinox.http.registry.internal.FilterManager$FilterWrapper.doFilter(FilterManager.java:176)
	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyFilterFactory$LegacyFilter.doFilter(HttpServiceRuntimeImpl.java:1406)
	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:128)
	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:48)
	at com.company.httpservice.filter.XFrameFilter.doFilter(XFrameFilter.java:24)
	at org.eclipse.equinox.http.registry.internal.FilterManager$FilterWrapper.doFilter(FilterManager.java:176)
	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyFilterFactory$LegacyFilter.doFilter(HttpServiceRuntimeImpl.java:1406)
	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:128)
	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:48)
	at com.company.core.rap.filter.ClientAuthenticationFilter.doFilter(ClientAuthenticationFilter.java:34)
	at org.eclipse.equinox.http.registry.internal.FilterManager$FilterWrapper.doFilter(FilterManager.java:176)
	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyFilterFactory$LegacyFilter.doFilter(HttpServiceRuntimeImpl.java:1406)
	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:128)
	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:48)
	at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:75)
	at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:117)
	at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.dispatch(ProxyServlet.java:147)
	at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.preprocess(ProxyServlet.java:115)
	at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:104)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:305)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:547)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:767)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:500)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
	at org.eclipse.jetty.server.HttpChannelOverHttp.earlyEOF(HttpChannelOverHttp.java:237)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1595)
	at org.eclipse.jetty.server.HttpConnection.parseRequestBuffer(HttpConnection.java:364)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:261)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.eclipse.jetty.io.EofException: Early EOF
	at org.eclipse.jetty.server.HttpInput$3.getError(HttpInput.java:1141)
	at org.eclipse.jetty.server.HttpInput$3.noContent(HttpInput.java:1129)
	at org.eclipse.jetty.server.HttpInput.read(HttpInput.java:321)
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:185)
	at org.eclipse.rap.json.JsonParser.read(JsonParser.java:319)
	at org.eclipse.rap.json.JsonParser.parse(JsonParser.java:60)
	at org.eclipse.rap.json.JsonValue.readFrom(JsonValue.java:92)
	at org.eclipse.rap.json.JsonObject.readFrom(JsonObject.java:123)
	at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.readRequestMessage(LifeCycleServiceHandler.java:108)
	... 84 common frames omitted

The errors seem to be linked to bug 560514: If I restore the previous state of org.eclipse.rap.rwt/js/rwt/widgets/Display.js the messages are gone.
Comment 1 Benjamin Brandl CLA 2020-08-24 05:12:25 EDT
What also seems to help is flipping the sendImmediate flag:

diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Display.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Display.js
index e55c68df4..9f33d4c67 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Display.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Display.js
@@ -195,7 +195,7 @@ rwt.widgets.Display.prototype = {
       if( navigator.sendBeacon ) {
         this._connection.sendBeacon();
       } else {
-        this._connection.sendImmediate( true );
+        this._connection.sendImmediate( false );
       }
     },
     "default" : function() {
Comment 2 Eclipse Genie CLA 2020-08-24 07:51:41 EDT
New Gerrit change created: https://git.eclipse.org/r/c/rap/org.eclipse.rap/+/168133
Comment 4 Benjamin Brandl CLA 2020-08-24 09:32:07 EDT
Wow, that was quick.

I can confirm that the changes prevent the exceptions. Also the shutdown messages are sent again: 
   {"head":{"shutdown":true,"requestCounter":1},"operations":[]}