Current smack Default Packet Reply Timeout of 5s is not optimized during user login process when run under android OS, possibly even on PC when the login server is heavily loaded.
aTalk implementation has changed the global default reply timeout to 10s. During login, aTalk has actually increases the reply timeout to 30s to ensure high degree of a successful login for slow android devices or heavily loaded server.
Currently it seems that there is no control of the reply timeout when the connection is made via the Reconnection Manager i.e. it uses the global default reply timeout.
As shown in the debug log, even aTalk increased default reply timeout of 10s is insufficient. Maybe smack would consider another independent reply timeout timer during login for user to change.
Note: the test is being carried out with Note-10+ and using home test server via WiFi connection.
Strangely it failed 100% for all the subsequent reconnections attempted (>10 times). Not sure if it is due to the disconnection error happen on:
<h1>400 Bad Request</h1>
cmeng: update 20191021 1:30pm
sorry it looks like it is nothing to do with reply timer setting. I seems that the <challenge/> noza just follow whatever time that is being set to. It is something else that is causing the Reconnection to failed 100%.
please refer to
Smack 4.4.0: Smack BOSH throws NoResponseException during login process even all nozas have been send and received properly
======== aTalk BOSH reconnection timeout ==========
2019-10-21 08:23:18.093 6677-7384/org.atalk.android E/(AndroidOmemoService.java:123)#initializationFailed: OmemoManager init failed
org.jivesoftware.smack.SmackException$NotConnectedException: The connection XMPPBOSHConnection[swordfish@atalk.org/atalk] (0) is no longer connected while waiting for response with IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=KE8NY-85)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (ignoreResourcepart): swordfish@atalk.org, FromMatchesFilter (full): atalk.org)) because of org.igniterealtime.jbosh.BOSHException: Could not parse body:
<?xml version='1.0'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<h1>400 Bad Request</h1>
at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:276)
at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:228)
at org.jivesoftware.smackx.pubsub.LeafNode.publish(LeafNode.java:330)
at org.jivesoftware.smackx.pubsub.LeafNode.publish(LeafNode.java:309)
at org.jivesoftware.smackx.pubsub.PubSubManager.tryToPublishAndPossibleAutoCreate(PubSubManager.java:452)
at org.jivesoftware.smackx.pep.PepManager.publish(PepManager.java:165)
at org.jivesoftware.smackx.omemo.OmemoService.publishBundle(OmemoService.java:592)
at org.jivesoftware.smackx.omemo.OmemoService.init(OmemoService.java:260)
at org.jivesoftware.smackx.omemo.OmemoManager.initialize(OmemoManager.java:251)
at org.jivesoftware.smackx.omemo.OmemoManager$2.run(OmemoManager.java:266)
at java.lang.Thread.run(Thread.java:764)
Caused by: org.igniterealtime.jbosh.BOSHException: Could not parse body:
2019-10-21 08:23:23.359 6677-7408/org.atalk.android D/SMACK: XMPPConnection (XMPPBOSHConnection[swordfish@atalk.org/atalk] (0)) will reconnect in 2
2019-10-21 08:23:24.363 6677-7408/org.atalk.android D/SMACK: XMPPConnection (XMPPBOSHConnection[swordfish@atalk.org/atalk] (0)) will reconnect in 1
2019-10-21 08:23:25.367 6677-7408/org.atalk.android D/SMACK: XMPPConnection (XMPPBOSHConnection[swordfish@atalk.org/atalk] (0)) will reconnect in 0
2019-10-21 08:23:25.369 6677-7408/org.atalk.android D/SMACK: XMPPConnection (XMPPBOSHConnection[swordfish@atalk.org/atalk] (0)) will reconnect in 0
2019-10-21 08:23:25.427 6677-7408/org.atalk.android D/SMACK: SENT (0):
<body ver='1.8' wait='60' xmpp:version='1.0' rid='5642716902741201' xmlns:xmpp='urn:xmpp:xbosh' hold='1' xml:lang='en' ack='1' to='atalk.org' xmlns='http://jabber.org/protocol/httpbind'>
</body>
2019-10-21 08:23:26.587 6677-7428/org.atalk.android D/SMACK: RECV (0):
<body xmpp:version='1.0' authid='8918239010385705058' xmlns='http://jabber.org/protocol/httpbind' sid='5d90d535ef1a1f860749b9d3ea1ad9579db1946c' wait='60' ver='1.11' polling='2' inactivity='30' hold='1' xmpp:restartlogic='true' requests='2' secure='true' maxpause='120' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' from='atalk.org'>
<stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>
PLAIN
</mechanism>
<mechanism>
SCRAM-SHA-1
</mechanism>
<mechanism>
X-OAUTH2
</mechanism>
</mechanisms>
<register xmlns='http://jabber.org/features/iq-register'/>
</stream:features>
</body>
2019-10-21 08:23:26.666 6677-7427/org.atalk.android D/SMACK: SENT (0):
<body rid='5642716902741202' sid='5d90d535ef1a1f860749b9d3ea1ad9579db1946c' xmlns='http://jabber.org/protocol/httpbind'>
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'>
biwsbj1zd29yZGZpc2gscj1AezBLLkhgIXZTeyZnKjZFc0JHQFwuanxmeFdcKWNTag==
</auth>
</body>
2019-10-21 08:23:36.709 6677-7427/org.atalk.android W/aTalk: [100141] org.igniterealtime.jbosh.BOSHClient.fireConnectionEstablished() Unhandled Exception
java.lang.RuntimeException: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). While waiting for successful SASL authentication
at org.jivesoftware.smack.bosh.XMPPBOSHConnection$BOSHConnectionListener.connectionEvent(XMPPBOSHConnection.java:447)
at org.igniterealtime.jbosh.BOSHClient.fireConnectionEstablished(BOSHClient.java:1633)
at org.igniterealtime.jbosh.BOSHClient.processExchange(BOSHClient.java:1165)
at org.igniterealtime.jbosh.BOSHClient.processMessages(BOSHClient.java:998)
at org.igniterealtime.jbosh.BOSHClient.access$300(BOSHClient.java:100)
at org.igniterealtime.jbosh.BOSHClient$RequestProcessor.run(BOSHClient.java:1727)
at java.lang.Thread.run(Thread.java:764)
Caused by: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). While waiting for successful SASL authentication
at org.jivesoftware.smack.sasl.SASLMechanism.throwExceptionIfRequired(SASLMechanism.java:339)
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:211)
at org.jivesoftware.smack.AbstractXMPPConnection.authenticate(AbstractXMPPConnection.java:861)
at org.jivesoftware.smack.bosh.XMPPBOSHConnection.loginInternal(XMPPBOSHConnection.java:221)
at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:646)
at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:603)
at org.jivesoftware.smack.bosh.XMPPBOSHConnection$BOSHConnectionListener.connectionEvent(XMPPBOSHConnection.java:444)
at org.igniterealtime.jbosh.BOSHClient.fireConnectionEstablished(BOSHClient.java:1633)
at org.igniterealtime.jbosh.BOSHClient.processExchange(BOSHClient.java:1165)
at org.igniterealtime.jbosh.BOSHClient.processMessages(BOSHClient.java:998)
at org.igniterealtime.jbosh.BOSHClient.access$300(BOSHClient.java:100)
at org.igniterealtime.jbosh.BOSHClient$RequestProcessor.run(BOSHClient.java:1727)
at java.lang.Thread.run(Thread.java:764)
2019-10-21 08:23:36.713 6677-7329/org.atalk.android W/g.atalk.androi: Long monitor contention with owner Smack DefaultReactor Thread #1 (7330) at void org.jivesoftware.smack.SmackReactor$Reactor.handleScheduledActionsOrPerformSelect()(SmackReactor.java:209) waiters=0 in void org.jivesoftware.smack.SmackReactor$Reactor.handleScheduledActionsOrPerformSelect() for 21.935s
2019-10-21 08:23:36.726 6677-7431/org.atalk.android D/SMACK: SENT (0):
<body rid='5642716902741203' ack='5642716902741201' sid='5d90d535ef1a1f860749b9d3ea1ad9579db1946c' xmlns='http://jabber.org/protocol/httpbind'>
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
Yz1iaXdzLHI9QHswSy5IYCF2U3smZyo2RXNCR0BcLmp8ZnhXXCljU2oxWU1kTElQMHVraDRqY3F1cU9La1B3PT0scD16WVlmeFFSbEhkMHh3dS9YMnhBTlFQcUZkOFU9
</response>
</body>
2019-10-21 08:23:36.728 6677-7428/org.atalk.android D/SMACK: RECV (0):
<body xmlns='http://jabber.org/protocol/httpbind'>
<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
cj1AezBLLkhgIXZTeyZnKjZFc0JHQFwuanxmeFdcKWNTajFZTWRMSVAwdWtoNGpjcXVxT0trUHc9PSxzPTVXVENHSnk1dk1FUWJpNmZWRVJ1S0E9PSxpPTQwOTY=
</challenge>
</body>