I’m getting a strange error and i can’t figure it out.
I have a simple test case (attached below) using Vaadin 7.1.3 and Apache Tomcat 7.0.42 (I’ve also tryed jetty 8)
Here’s the stack trace:
set 02, 2013 3:03:00 PM org.atmosphere.websocket.DefaultWebSocketProcessor dispatch
WARNING: Failed invoking AtmosphereFramework.doCometSupport()
java.lang.AssertionError
at com.vaadin.server.communication.AtmospherePushConnection.disconnect(AtmospherePushConnection.java:204)
at com.vaadin.ui.UI.setPushConnection(UI.java:1399)
at com.vaadin.server.communication.PushHandler$1.run(PushHandler.java:119)
at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:289)
at com.vaadin.server.communication.PushHandler.onRequest(PushHandler.java:306)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:259)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:166)
at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:137)
at org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket.service(Tomcat7AsyncSupportWithWebSocket.java:59)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1448)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:219)
at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:133)
at org.atmosphere.container.TomcatWebSocketHandler.onOpen(TomcatWebSocketHandler.java:67)
at org.apache.catalina.websocket.StreamInbound.onUpgradeComplete(StreamInbound.java:247)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
set 02, 2013 3:03:00 PM org.atmosphere.websocket.protocol.SimpleHttpProtocol onError
WARNING: java.lang.AssertionError Status 500 Message Server Error
How to reproduce:
1- Launche the application
2- Click a button (no matter what) to make a push request
3- Refresh the page (F5)
Like i said before i can’t figure out the problem, and i’m quite surprised not finding others reporting this. To me it seem a sync problem where the Ui still store a reference of an already closed pushConnection.
Maybe i’ve found something, as i conjecture before, it’s a race condition:
The problem is that when you hit refresh (F5) there are 2 concurrent process:
The creation of a new WebSocket
The closure of the old one
If the closure is completely handled before the new one, all work smoothly. But if the new connection is handled after the end of the closing, the assertion will triggers:
in fact the connection closure will trigger :
DefaultBroadcaster.removeAtmosphereResource() {
//...
removed = resources.remove(r);
//...
}
that will silently fail if the connection is already closed
But, the new connection will trigger:
I have a similar problem on Vaadin 7.1.5 and Tomcat 7.
Did you manage to work around this?
To make things worse, I am evaluating JRebel for this environment and this exception is now a blocker (without JRebel it was just a log line)
I tested again on 7.1.6 and my problem is still there.
This is my stack trace (from 7.1.5):
Oct 02, 2013 3:58:14 PM org.atmosphere.cpr.AtmosphereFramework addAtmosphereHandler
INFO: Installed AtmosphereHandler com.vaadin.server.communication.PushHandler mapped to context-path: /*
Oct 02, 2013 3:58:15 PM org.atmosphere.cpr.DefaultBroadcaster <init>
INFO: /* support Out Of Order Broadcast: false
Oct 02, 2013 3:58:15 PM org.atmosphere.cpr.AtmosphereFramework autoDetectWebSocketHandler
INFO: Auto detecting WebSocketHandler in /WEB-INF/classes/
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework initWebSocket
INFO: Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework autoDetectContainer
INFO: Atmosphere is using async support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket running under container: Apache Tomcat/7.0.42
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework configureAtmosphereInterceptor
INFO: Installed Default AtmosphereInterceptor [Android Interceptor Support, SSE Interceptor Support, JSONP Interceptor Support, Atmosphere JavaScript Protocol, Browser disconnection detection]
. Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults in your xml to disable them.
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework init
WARNING: No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework init
INFO: Shared ExecutorService supported: true
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework init
INFO: HttpSession supported: true
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework init
INFO: Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework init
INFO: Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework init
INFO: Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework init
INFO: Atmosphere Framework 1.0.14.vaadin4 started.
Oct 02, 2013 3:58:17 PM org.atmosphere.cpr.AtmosphereFramework interceptor
INFO: Installed AtmosphereInterceptor Track Message Size Interceptor using |.
Oct 02, 2013 3:58:18 PM org.atmosphere.websocket.DefaultWebSocketProcessor dispatch
WARNING: Failed invoking AtmosphereFramework.doCometSupport()
java.lang.NoSuchMethodError: org.json.JSONObject.put(Ljava/lang/String;Ljava/util/Collection;)Lorg/json/JSONObject;
at com.vaadin.server.VaadinService.createCriticalNotificationJSON(VaadinService.java:1555)
at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:256)
at com.vaadin.server.communication.PushHandler.onRequest(PushHandler.java:306)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:259)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:166)
at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:137)
at org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket.service(Tomcat7AsyncSupportWithWebSocket.java:59)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1448)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:219)
at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:133)
at org.atmosphere.container.TomcatWebSocketHandler.onOpen(TomcatWebSocketHandler.java:67)
at org.apache.catalina.websocket.StreamInbound.onUpgradeComplete(StreamInbound.java:247)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Oct 02, 2013 3:58:18 PM org.atmosphere.websocket.protocol.SimpleHttpProtocol onError
WARNING: java.lang.NoSuchMethodError: org.json.JSONObject.put(Ljava/lang/String;Ljava/util/Collection;)Lorg/json/JSONObject; Status 500 Message Server Error
Oct 02, 2013 3:58:18 PM org.atmosphere.websocket.DefaultWebSocketProcessor dispatch
WARNING: Failed invoking AtmosphereFramework.doCometSupport()
java.lang.NoSuchMethodError: org.json.JSONObject.put(Ljava/lang/String;Ljava/util/Collection;)Lorg/json/JSONObject;
at com.vaadin.server.VaadinService.createCriticalNotificationJSON(VaadinService.java:1555)
at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:256)
at com.vaadin.server.communication.PushHandler.onRequest(PushHandler.java:306)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:259)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:166)
at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:137)
at org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket.service(Tomcat7AsyncSupportWithWebSocket.java:59)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1448)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:219)
at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:133)
at org.atmosphere.container.TomcatWebSocketHandler.onOpen(TomcatWebSocketHandler.java:67)
at org.apache.catalina.websocket.StreamInbound.onUpgradeComplete(StreamInbound.java:247)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Oct 02, 2013 3:58:18 PM org.atmosphere.websocket.protocol.SimpleHttpProtocol onError
WARNING: java.lang.NoSuchMethodError: org.json.JSONObject.put(Ljava/lang/String;Ljava/util/Collection;)Lorg/json/JSONObject; Status 500 Message Server Error
[font=Courier New]
[/font][font=Courier New]
[/font][size=6]
[/size][font=Courier New]
[/font]