Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6782

WebSocket onError/onAbort is not being called

    XMLWordPrintableJSON

Details

    • Patch

    Description

      WebSocket connection is closed on page reload,
      but none of my onError/onAbort handlers are being called

      ERROR 05-01 16:10:21.740 o.a.w.p.w.j.WicketEndpoint:100 [EventExec-e2-t9] - An error occurred in web socket connection with id : 10
      java.io.IOException: java.io.IOException: Broken pipe
      	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:315)
      	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:258)
      	at org.apache.tomcat.websocket.WsSession.sendCloseMessage(WsSession.java:612)
      	at org.apache.tomcat.websocket.WsSession.doClose(WsSession.java:497)
      	at org.apache.tomcat.websocket.WsSession.doClose(WsSession.java:459)
      	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:313)
      	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:250)
      	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:191)
      	at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
      	at org.apache.wicket.protocol.ws.javax.JavaxWebSocketConnection.sendMessage(JavaxWebSocketConnection.java:81)
      	at org.apache.openmeetings.core.util.WebSocketHelper.lambda$sendClient$1(WebSocketHelper.java:75)
      	at org.apache.openmeetings.core.util.WebSocketHelper.lambda$sendClient$2(WebSocketHelper.java:94)
      	at org.apache.wicket.protocol.ws.WebSocketSettings$SameThreadExecutor.run(WebSocketSettings.java:393)
      	at org.apache.openmeetings.core.util.WebSocketHelper.sendClient(WebSocketHelper.java:94)
      	at org.apache.openmeetings.core.util.WebSocketHelper.sendClient(WebSocketHelper.java:73)
      	at org.apache.openmeetings.core.remote.KurentoHandler.sendClient(KurentoHandler.java:209)
      	at org.apache.openmeetings.core.remote.KStream.lambda$createEndpoint$5(KStream.java:224)
      	at org.kurento.client.internal.client.RemoteObjectInvocationHandler.propagateEventTo(RemoteObjectInvocationHandler.java:281)
      	at org.kurento.client.internal.client.RemoteObjectInvocationHandler$1.onEvent(RemoteObjectInvocationHandler.java:208)
      	at org.kurento.client.internal.client.RemoteObject.fireEvent(RemoteObject.java:345)
      	at org.kurento.client.internal.client.RomClientObjectManager.processEvent(RomClientObjectManager.java:58)
      	at org.kurento.client.internal.transport.jsonrpc.RomClientJsonRpcClient.processEvent(RomClientJsonRpcClient.java:206)
      	at org.kurento.client.internal.transport.jsonrpc.RomClientJsonRpcClient.access$000(RomClientJsonRpcClient.java:74)
      	at org.kurento.client.internal.transport.jsonrpc.RomClientJsonRpcClient$1.handleRequest(RomClientJsonRpcClient.java:182)
      	at org.kurento.jsonrpc.internal.JsonRpcHandlerManager.handleRequest(JsonRpcHandlerManager.java:142)
      	at org.kurento.jsonrpc.client.AbstractJsonRpcClientWebSocket$15.run(AbstractJsonRpcClientWebSocket.java:577)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.io.IOException: Broken pipe
      	at java.base/sun.nio.ch.FileDispatcherImpl.write0(Native Method)
      	at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
      	at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:113)
      	at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:79)
      	at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
      	at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
      	at org.apache.tomcat.util.net.SecureNioChannel.flush(SecureNioChannel.java:145)
      	at org.apache.tomcat.util.net.SecureNioChannel.write(SecureNioChannel.java:851)
      	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper$NioOperationState.run(NioEndpoint.java:1491)
      	at org.apache.tomcat.util.net.SocketWrapperBase$OperationState.start(SocketWrapperBase.java:1015)
      	at org.apache.tomcat.util.net.SocketWrapperBase.vectoredOperation(SocketWrapperBase.java:1426)
      	at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:1352)
      	at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:1323)
      	at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.doWrite(WsRemoteEndpointImplServer.java:90)
      	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(WsRemoteEndpointImplBase.java:499)
      	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:309)
      	... 25 common frames omitted
      DEBUG 05-01 16:10:21.741 o.a.w.p.w.a.AbstractWebSocketProcessor:299 [EventExec-e2-t9] - Either there is no connection(org.apache.wicket.protocol.ws.javax.JavaxWebSocketConnection@43539f89) or it is closed.
      DEBUG 05-01 16:10:21.741 o.a.w.p.w.j.WicketEndpoint:82 [EventExec-e2-t9] - Web Socket connection with id '10' has been closed with code '1006' and reason: Broken pipe
      

      Here are some more details on this issue

      In our code I'm using IWebSocketConnection.sendMessage(String) method
      The call is wrapped with try/catch to correctly handle any exception [1]

      The problem is hard to reproduce due to IOException should happen exactly at time of sendMessage do it's job
      (in original report author hammer the page with F5 until error will occur)

      As a result my try/catch doesn't play, I got "zombie" IWebSocketConnection in IWebSocketConnectionRegistry
      and incorrect application state due to I'm expecting to get disconnect from onError/onAbort of my WebSocketBehavior

      [1] https://github.com/apache/openmeetings/blob/master/openmeetings-core/src/main/java/org/apache/openmeetings/core/util/WebSocketHelper.java#L76

      Attachments

        Issue Links

          Activity

            People

              solomax Maxim Solodovnik
              solomax Maxim Solodovnik
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: