powered by Jive Software

Websocket randomly drops connection

I am using the javascript library stanza.io and connecting via websocket.

I see every send message in openfire logs, however a lot of time they don’t alway end up coming back through the recipients websocket connection.

My ws connection sometimes will lose connection entirely (no events) and restarting the two servers I have openfire on fixes this problem. I’m at a brick wall and have no idea why messages are received sometimes through the ws connection and not others when they are all stored in the logs.

2018.04.23 11:46:31 org.jivesoftware.openfire.websocket.XmppWebSocket - Error detected; session: WebSocketSession[websocket=JettyAnnotatedEventDriver[org.jivesoftware.openfire.websocket.XmppWebSocket@4836262],behavior=SERVER,connection=WebSocketServerConnection@6431c4be[FILLING,DecryptedEndPoint@44a50f0c{/xxxxxxxx:xxxx<->7443,Open,in,out,-,-,59190/300000,WebSocketServerConnection}->SelectChannelEndPoint@10e8e436{/xxxxxx:xxxx<->7443,Open,in,out,-,-,1/300000,SslConnection}{io=0,kio=0,kro=1}]{f=Flusher[queueSize=0,aggregateSize=9,failure=org.eclipse.jetty.io.EofException],g=Generator[SERVER,validating,+rsv1],p=Parser@6e4b32f[ExtensionStack,s=START,c=0,len=5,f=TEXT[len=0,fin=true,rsv=1..,masked=true],p=WebSocketPolicy@196b51e3[behavior=SERVER,maxTextMessageSize=1048576,maxTextMessageBufferSize=5242880,maxBinaryMessageSize=65536,maxBinaryMessageBufferSize=32768,asyncWriteTimeout=60000,idleTimeout=300000,inputBufferSize=4096]]},remote=WebSocketRemoteEndpoint@73957244[batching=true],incoming=JettyAnnotatedEventDriver[org.jivesoftware.openfire.websocket.XmppWebSocket@4836262],outgoing=ExtensionStack[queueSize=0,extensions=[permessage-deflate],incoming=org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension,outgoing=org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension]]
org.eclipse.jetty.io.EofException
	at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:192)
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:808)
	at org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:408)
	at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:302)
	at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:129)
	at org.eclipse.jetty.websocket.common.io.FrameFlusher$Flusher.flush(FrameFlusher.java:152)
	at org.eclipse.jetty.websocket.common.io.FrameFlusher$Flusher.process(FrameFlusher.java:211)
	at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:246)
	at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:208)
	at org.eclipse.jetty.websocket.common.io.FrameFlusher.enqueue(FrameFlusher.java:381)
	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.outgoingFrame(AbstractWebSocketConnection.java:567)
	at org.eclipse.jetty.websocket.common.extensions.AbstractExtension.nextOutgoingFrame(AbstractExtension.java:169)
	at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.nextOutgoingFrame(PerMessageDeflateExtension.java:116)
	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension.access$1100(CompressExtension.java:42)
	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension$Flusher.compress(CompressExtension.java:509)
	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension$Flusher.deflate(CompressExtension.java:413)
	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension$Flusher.process(CompressExtension.java:394)
	at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:246)
	at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:208)
	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension.outgoingFrame(CompressExtension.java:207)
	at org.eclipse.jetty.websocket.common.extensions.ExtensionStack$Flusher.process(ExtensionStack.java:389)
	at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:246)
	at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:208)
	at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.outgoingFrame(ExtensionStack.java:290)
	at org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.uncheckedSendFrame(WebSocketRemoteEndpoint.java:304)
	at org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.sendAsyncFrame(WebSocketRemoteEndpoint.java:234)
	at org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.sendStringByFuture(WebSocketRemoteEndpoint.java:406)
	at org.jivesoftware.openfire.websocket.XmppWebSocket.deliver(XmppWebSocket.java:188)
	at org.jivesoftware.openfire.websocket.WebSocketConnection.deliverRawText(WebSocketConnection.java:102)
	at org.jivesoftware.openfire.session.LocalSession.deliverRawText(LocalSession.java:419)
	at org.jivesoftware.openfire.streammanagement.StreamManager.sendServerAcknowledgement(StreamManager.java:309)
	at org.jivesoftware.openfire.streammanagement.StreamManager.process(StreamManager.java:136)
	at org.jivesoftware.openfire.websocket.StreamManagementPacketRouter.route(StreamManagementPacketRouter.java:59)
	at org.jivesoftware.openfire.websocket.XmppWebSocket.processStanza(XmppWebSocket.java:241)
	at org.jivesoftware.openfire.websocket.XmppWebSocket.onTextMethod(XmppWebSocket.java:115)
	at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(CallableMethod.java:70)
	at org.eclipse.jetty.websocket.common.events.annotated.OptionalSessionCallableMethod.call(OptionalSessionCallableMethod.java:72)
	at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver.onTextMessage(JettyAnnotatedEventDriver.java:234)
	at org.eclipse.jetty.websocket.common.message.SimpleTextMessage.messageComplete(SimpleTextMessage.java:69)
	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.appendMessage(AbstractEventDriver.java:65)
	at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver.onTextFrame(JettyAnnotatedEventDriver.java:226)
	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingFrame(AbstractEventDriver.java:161)
	at org.eclipse.jetty.websocket.common.WebSocketSession.incomingFrame(WebSocketSession.java:308)
	at org.eclipse.jetty.websocket.common.extensions.AbstractExtension.nextIncomingFrame(AbstractExtension.java:163)
	at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.nextIncomingFrame(PerMessageDeflateExtension.java:105)
	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension.forwardIncoming(CompressExtension.java:136)
	at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.incomingFrame(PerMessageDeflateExtension.java:85)
	at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(ExtensionStack.java:214)
	at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:220)
	at org.eclipse.jetty.websocket.common.Parser.parse(Parser.java:258)
	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:632)
	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:480)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Broken pipe
	at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
	at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
	at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
	at sun.nio.ch.IOUtil.write(IOUtil.java:65)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
	at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:170)
	... 58 more