Hi Maxim, If WicketEndpoint#onError() [1] is not called then probably there is a bug in Tomcat. I suggest you to post this question at Tomcat's users@.
1. https://github.com/apache/wicket/blob/master/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/WicketEndpoint.java#L92 On Fri, May 1, 2020 at 12:21 PM Maxim Solodovnik <solomax...@gmail.com> wrote: > Hello, > > I'm having weird situation: WebSocket connection is closed on page reload, > but none of my onClose/onError/onAbort handlers are being called > I have changed wicket version to latest SNAPSHOT and got some debug logs: > > *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 > > > apache-tomcat-9.0.34 is being used as Web server > Standard WebSocketSettings is being used (notifyOnClose and notifyOnError > are ON) > > Not sure if quickstart is possible here :( > > Can it be fixed inside Wicket? Or shall I add some guards in my > application? > > -- > Best regards, > Maxim >