Thanks Martin! https://issues.apache.org/jira/browse/WICKET-6782 will create PR in a moment :)
On Wed, 6 May 2020 at 00:22, Martin Grigorov <mgrigo...@apache.org> wrote: > Hi Maxim, > > On Fri, May 1, 2020 at 2:22 PM Maxim Solodovnik <solomax...@gmail.com> > wrote: > > > On Fri, 1 May 2020 at 18:15, Martin Grigorov <mgrigo...@apache.org> > wrote: > > > > > Hi Maxim, > > > > > > On Fri, May 1, 2020 at 1:31 PM Maxim Solodovnik <solomax...@gmail.com> > > > wrote: > > > > > > > Hello Martin, > > > > > > > > WicketEndpoint#onError is 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" > > > > > > > > The problem WebSocketBehavior#onError is not being called > > > > So my application doesn't get notified the connection has been closed > > > .... > > > > > > > > > > Then it must be somewhere in Wicket. > > > Check that [2] is called. > > > > > > > Yes it is called > > > > > > > Then [3], then [4]. From here on it is Wicket Event propagation [5]. It > > > > > > > [3] and [4] are not called > > As you can see from the log branch at > > > > > https://github.com/apache/wicket/blob/d43c68c0126306021a12afbfe7876a36612fbbc3/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L299 > > is in effect: > > > > At > > https://github.com/apache/wicket/blob/d43c68c0126306021a12afbfe7876a36612fbbc3/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L223 > we > check > whether the connection is still opened or it is a ClosedMessage. > ClosedMessage is broadcasted exactly for this reason: > > https://github.com/apache/wicket/commit/ffa34c6bfbd2ccd8340e23ff1601edd3e0e941d6 > We should simplify this condition to allow ErrorMessage too. Maybe even > AbortedMessage. > For the erroneous kind of messages we can even remove the connection from > the registry at the bottom of this method. > Please play with it and suggest a change! > > Martin > > > > 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. > > > > > > > > > > > won't find your behavior if it is not enabled or any of if its > component > > > hierarchy is disabled/invisible. > > > > > > > > > 2. > > > > > > > > > https://github.com/apache/wicket/blob/d43c68c0126306021a12afbfe7876a36612fbbc3/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L202 > > > 3. > > > > > > > > > https://github.com/apache/wicket/blob/d43c68c0126306021a12afbfe7876a36612fbbc3/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L272 > > > 4. * > > > > > > https://github.com/apache/wicket/blob/d43c68c0126306021a12afbfe7876a36612fbbc3/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketMessageBroadcastHandler.java#L69 > > > < > > > > > > https://github.com/apache/wicket/blob/d43c68c0126306021a12afbfe7876a36612fbbc3/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketMessageBroadcastHandler.java#L69 > > > >* > > > 5. > > > > > > > > > https://github.com/apache/wicket/blob/d43c68c0126306021a12afbfe7876a36612fbbc3/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketBehavior.java#L86 > > > > > > > > > > :( > > > > > > > > On Fri, 1 May 2020 at 17:12, Martin Grigorov <mgrigo...@apache.org> > > > wrote: > > > > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Best regards, > > > > Maxim > > > > > > > > > > > > > -- > > Best regards, > > Maxim > > > -- Best regards, Maxim