We are hitting a problem(in jigasi) which leads to blocking all SmackReactor threads and the problem connections cannot be detected and most of the xmpp functionality is blocked and doesn’t work.
What we see in the dump is that SmackReactor has a queue of more than a 100 actions scheduled for several hours without being executed (7 hours in the dump I have).
Smack DefaultReactor Thread #0 Waiting Thread ID: 13
jdk.internal.misc.Unsafe.park(Unsafe.java)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081)
org.igniterealtime.jbosh.BOSHClient.blockUntilSendable(BOSHClient.java:830)
org.igniterealtime.jbosh.BOSHClient.send(BOSHClient.java:485)
org.jivesoftware.smack.bosh.XMPPBOSHConnection.send(XMPPBOSHConnection.java:321)
org.jivesoftware.smack.bosh.XMPPBOSHConnection.sendElement(XMPPBOSHConnection.java:252)
org.jivesoftware.smack.bosh.XMPPBOSHConnection.sendStanzaInternal(XMPPBOSHConnection.java:247)
org.jivesoftware.smack.AbstractXMPPConnection.sendStanza(AbstractXMPPConnection.java:873)
org.jivesoftware.smack.AbstractXMPPConnection.sendAsync(AbstractXMPPConnection.java:2004)
org.jivesoftware.smack.AbstractXMPPConnection.sendIqRequestAsync(AbstractXMPPConnection.java:1940)
org.jivesoftware.smackx.ping.PingManager.pingAsync(PingManager.java:198)
org.jivesoftware.smackx.ping.PingManager.pingServerIfNecessary(PingManager.java:440)
org.jivesoftware.smackx.ping.PingManager$$Lambda$240.run()
org.jivesoftware.smack.ScheduledAction.run(ScheduledAction.java:84)
org.jivesoftware.smack.SmackReactor$Reactor.handleScheduledActionsOrPerformSelect(SmackReactor.java:208)
org.jivesoftware.smack.SmackReactor$Reactor.reactorLoop(SmackReactor.java:188)
org.jivesoftware.smack.SmackReactor$Reactor.run(SmackReactor.java:173)
Smack DefaultReactor Thread #1 Waiting Thread ID: 14
jdk.internal.misc.Unsafe.park(Unsafe.java)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081)
org.igniterealtime.jbosh.BOSHClient.blockUntilSendable(BOSHClient.java:830)
org.igniterealtime.jbosh.BOSHClient.send(BOSHClient.java:485)
org.jivesoftware.smack.bosh.XMPPBOSHConnection.send(XMPPBOSHConnection.java:321)
org.jivesoftware.smack.bosh.XMPPBOSHConnection.sendElement(XMPPBOSHConnection.java:252)
org.jivesoftware.smack.bosh.XMPPBOSHConnection.sendStanzaInternal(XMPPBOSHConnection.java:247)
org.jivesoftware.smack.AbstractXMPPConnection.sendStanza(AbstractXMPPConnection.java:873)
org.jivesoftware.smack.AbstractXMPPConnection.sendAsync(AbstractXMPPConnection.java:2004)
org.jivesoftware.smack.AbstractXMPPConnection.sendIqRequestAsync(AbstractXMPPConnection.java:1940)
org.jivesoftware.smackx.ping.PingManager.pingAsync(PingManager.java:198)
org.jivesoftware.smackx.ping.PingManager.pingServerIfNecessary(PingManager.java:440)
org.jivesoftware.smackx.ping.PingManager$$Lambda$240.run()
org.jivesoftware.smack.ScheduledAction.run(ScheduledAction.java:84)
org.jivesoftware.smack.SmackReactor$Reactor.handleScheduledActionsOrPerformSelect(SmackReactor.java:208)
org.jivesoftware.smack.SmackReactor$Reactor.reactorLoop(SmackReactor.java:188)
org.jivesoftware.smack.SmackReactor$Reactor.run(SmackReactor.java:173)
There are several threads waiting for the same lock.
The bosh is stalled in:
"RequestProcessor[446930054]: Receive thread 0" #73 daemon prio=5 os_prio=0 cpu=659.51ms elapsed=64122.82s tid=0x00005615d7f04800 nid=0x1f47 runnable [0x00007ff76d1d4000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(java.base@11.0.15/Native Method)
at java.net.SocketInputStream.socketRead(java.base@11.0.15/SocketInputStream.java:115)
at java.net.SocketInputStream.read(java.base@11.0.15/SocketInputStream.java:168)
at java.net.SocketInputStream.read(java.base@11.0.15/SocketInputStream.java:140)
at sun.security.ssl.SSLSocketInputRecord.read(java.base@11.0.15/SSLSocketInputRecord.java:478)
at sun.security.ssl.SSLSocketInputRecord.readHeader(java.base@11.0.15/SSLSocketInputRecord.java:472)
at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(java.base@11.0.15/SSLSocketInputRecord.java:70)
at sun.security.ssl.SSLSocketImpl.readApplicationRecord(java.base@11.0.15/SSLSocketImpl.java:1454)
at sun.security.ssl.SSLSocketImpl$AppInputStream.read(java.base@11.0.15/SSLSocketImpl.java:1065)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:161)
at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:82)
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:276)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:294)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:257)
at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:230)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:679)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:481)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.igniterealtime.jbosh.ApacheHTTPResponse.awaitResponse(ApacheHTTPResponse.java:235)
- locked <0x0000000748750ce0> (a org.igniterealtime.jbosh.ApacheHTTPResponse)
at org.igniterealtime.jbosh.ApacheHTTPResponse.getBody(ApacheHTTPResponse.java:192)
at org.igniterealtime.jbosh.BOSHClient.processExchange(BOSHClient.java:1123)
at org.igniterealtime.jbosh.BOSHClient.processMessages(BOSHClient.java:999)
at org.igniterealtime.jbosh.BOSHClient.access$300(BOSHClient.java:100)
at org.igniterealtime.jbosh.BOSHClient$RequestProcessor.run(BOSHClient.java:1728)
at java.lang.Thread.run(java.base@11.0.15/Thread.java:829)
And this never timeouts. We normally detect stalled connections with pings and trigger a reconnect, but when the both threads of the reactor are blocked that is impossible.
SmackReactor is supposed to be used with non-blocking I/O but in the case of bosh this is blocking.
@Flow wdyt? What is the way to go here? Any help is welcome Thanks