Android XMPP using smack: First attempt always fail

We are using asmack library (asmack-android-10-0.8.10) in our android app, we use it in order to connect to our XMPP server. Always in the first attempt we get an error:

xmppServicesBot [] xmppServer +[]
W/System.err(16560): service-unavailable(503)
W/System.err(16560):     at org.jivesoftware.smack.NonSASLAuthentication.authenticate(
W/System.err(16560):     at org.jivesoftware.smack.XMPPConnection.login(
W/System.err(16560):     at
W/System.err(16560):     at
W/System.err(16560):     at$000(
W/System.err(16560):     at$ (16560): [xmppThread] Connect Failed, sleeping 1 second and trying again.

Then the app waits for a second in order to retry the connection,then on the second attempt the app is able to connect into the servers. I’m not sure why we get this condition? We think it is a race condition, because if we delay the first attempt in 5 seconds, we get the connection without any error.

I really appreciate some help


I don’t think it’s a race. I guess you could simply debug the code to determine what’s causing this. I also recommend switching to a more recent aSmack version (4.0.6 at the time of writing).