ReconnectionManager giving up after an error when SM enabled

We ran into an issue with ReconnectionManager and stream resumption. I can reproduce with both 4.4.8 and 4.4.6. The scenario is the following:

  1. Enable ReconnectionManager with fixed delay 1 second
  2. Connect and login successfully
  3. Restart the XMPP server, removing the virtual domain
  4. Smack attempts to re-connect and gets a host-unknown error

Expected behavior:
Smack should continue to attempt to re-connect at 1 second interval.

Actual behavior:
Smack stops the re-connect attempts.

The issue only occurs when Stream Management is enabled. If we disable it, the behavior is as expected. Also, if we stop the XMPP server instead of mis-configuring it, so the TCP socket fails to connect then the behavior is as expected.

XMPPTCPConnection.setUseStreamManagementResumptionDefault(false);
XMPPTCPConnection.setUseStreamManagementDefault(false);

I suspect it has to do with ReconnectionManager running after the XMPPTCPConnection is marked as connected here, but I don’t understand the details:

This file can help repro the problem (you need the server setup as well):

Thanks for the detailed issue report. I hope to find the time to look into it soon.

1 Like