Smack 4.2.0
Android application
11-21 14:47:48.715 D/SMACK: SENT (0): <stream:stream xmlns='jabber:client' to='backend' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='user@backend' xml:lang='en'>
11-21 14:47:48.746 D/SMACK: RECV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='15E774FAF5FA6617' from='backend' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/><amp xmlns='http://jabber.org/feature/amp'/><sm xmlns='urn:xmpp:sm:3'/></stream:features>
11-21 14:47:48.784 D/SMACK: SENT (0): <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls>
11-21 14:47:48.808 D/SMACK: RECV (0): <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
11-21 14:47:49.551 D/SMACK: SENT (0): <stream:stream xmlns='jabber:client' to='backend' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='user@backend' xml:lang='en'>
11-21 14:47:49.631 D/SMACK: RECV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='DB711ED103AEC73A' from='backend' version='1.0' xml:lang='en'>
11-21 14:47:49.636 D/SMACK: RECV (0): <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/><amp xmlns='http://jabber.org/feature/amp'/><sm xmlns='urn:xmpp:sm:3'/></stream:features>
11-21 14:47:49.770 D/SMACK: SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='SCRAM-SHA-1'>biwsbj0zMjQ4NjkwOTI1NyxyPU8tTXtnV29mfGRFaG02RFJvKX5vJCVncHJ3THkuVU4m</auth>
11-21 14:47:49.809 D/SMACK: RECV (0): <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cj1PLU17Z1dvZnxkRWhtNkRSbyl+byQlZ3Byd0x5LlVOJmxkaDkvNHg2dVFPbWtOdCszeDNKWmc9PSxzPSs1K2hKdHFtUUlGMEt4cmo2OU9SVWc9PSxpPTQwOTY=</challenge>\
11-21 14:47:52.999 V/FA: Inactivity, disconnecting from the service
11-21 14:47:54.535 D/SyncContactsTask: Init persisted items finished
11-21 14:47:54.536 D/SyncContactsTask: Checking changes
11-21 14:47:55.299 I/zygote64: Compiler allocated 8MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
11-21 14:47:56.412 D/SyncContactsTask: Initialized RawContacts. Updated contacts: 0
11-21 14:47:56.413 D/SyncContactsTask: Contacts are up to date. Aborting
11-21 14:47:59.796 W/AbstractXMPPConnection: Connection XMPPTCPConnection[not-authenticated] (0) closed with error
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.SASLAuthentication.authenticate(SASLAuthentication.java:223)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginInternal(XMPPTCPConnection.java:385)
at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:491)
at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:448)
at com.app.AppService.login(AppService.java:254)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
11-21 14:48:00.228 D/SMACK: SENT (0): <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>Yz1iaXdzLHI9Ty1Ne2dXb2Z8ZEVobTZEUm8pfm8kJWdwcndMeS5VTiZsZGg5LzR4NnVRT21rTnQrM3gzSlpnPT0scD0wZWUxZDhXTEdwMkpzUE9pQ3I4eUZWUWJOT289</response>
11-21 14:48:00.252 D/SMACK: RECV (0): <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dj1WWjl2MzZjNlVmRWRSZWt2cGNtS2ttOEYxRGs9</success>
11-21 14:48:00.271 D/SMACK: SENT (0): <stream:stream xmlns='jabber:client' to='backend' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='user@backend' id='DB711ED103AEC73A' xml:lang='en'>
11-21 14:48:00.354 D/SMACK: RECV (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='8EFD75CEC577B6E7' from='backend' version='1.0' xml:lang='en'>
11-21 14:48:00.362 D/SMACK: RECV (0): <stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/><register xmlns='http://jabber.org/features/iq-register'/><amp xmlns='http://jabber.org/feature/amp'/><sm xmlns='urn:xmpp:sm:3'/></stream:features>
In our application, from time to time we get this kind of error while logging in. There is no exact way to reproduce it.
After digging the code/debugging the app, I have noticed the following:
Since 11-21 14:47:49.809 till 11-21 14:48:00.228 the application was doing nothing with the connection. Basically, method org.jivesoftware.smack.SASLAuthentication#authenticate
was in a waiting loop, and org.jivesoftware.smack.SASLAuthentication#challengeReceived(java.lang.String)
was never invoked after the 11-21 14:47:49.809 D/SMACK: RECV (0): <challenge
stanza was received. And the challengeReceived method was only invoked after the authenticate method has finished it’s waiting loop with an exception.
Taking into an account this, I assume that somehow PacketReader is getting blocked by some of the Threads causing the impossibility of logging in. As it is happening during the application launch, there are some other AsyncTasks running in the background, so it might be the case that one of them is causing the problem.
I am having big problems with debugging it and troubleshooting this. Do you have any clues, ideas and reasons of why PacketParser can be locked?
Dmitry