ConnectionListener can't reconnect to OpenFire

Hi All,

System overview configuration:

  • OpenFire Server ver 3.7.1
  • Smack-3.2.1.jar & Smackx-3.2.1.jar
  • Smack Client establish 17 (#0-16) connections to OpenFire that are working properly.
  • each connection is set with: setReconnectionAllowed(true);

The Issue:

  1. Restarting OpenFire server (via “./openfire stop” then “./openfire start”)

  2. ConnectionListener is trying to reconnect to the server every 1 second for each 0-16# connections (via ConnectionListener.reconnectingIn() ):

@Override

public void reconnectingIn(int arg0) {

logger.warn(“[{0}] trying to reconnect”,xmppConnectionParams.getSource(connectionSeqNum));

}

23/10/2012 10:47:47,170 [Smack Reconnection Manager] WARN [1038#0] trying to reconnect

23/10/2012 10:47:47,439 [Smack Reconnection Manager] WARN [1038#9] trying to reconnect

23/10/2012 10:47:47,617 [Smack Reconnection Manager] WARN [1038#10] trying to reconnect

23/10/2012 10:47:47,914 [Smack Reconnection Manager] WARN [1038#4] trying to reconnect

23/10/2012 10:47:47,914 [Smack Reconnection Manager] WARN [1038#15] trying to reconnect

23/10/2012 10:47:47,921 [Smack Reconnection Manager] WARN [1038#11] trying to reconnect

23/10/2012 10:47:47,922 [Smack Reconnection Manager] WARN [1038#3] trying to reconnect

23/10/2012 10:47:47,922 [Smack Reconnection Manager] WARN [1038#14] trying to reconnect

23/10/2012 10:47:47,942 [Smack Reconnection Manager] WARN [1038#1] trying to reconnect

23/10/2012 10:47:47,943 [Smack Reconnection Manager] WARN [1038#8] trying to reconnect

23/10/2012 10:47:47,945 [Smack Reconnection Manager] WARN [1038#16] trying to reconnect

  1. Only 0-2 of the 17 connections will managed to reconnect within 2 hours, the rest not.

  2. For every 10 reconnects tries, ConnectionListener.reconnectionFailed() will be called.

  • i’ve tried to add to this listener function, the conenction function (that are working properly on a running environment)

=> smack.Connection.disconnect() / smack.Connection.connect() - but it didn’t helped at all.

  1. Network traffic between the Smack and OpenFire server shows that OpenFire rejects all the reconnects tries and closes them:

Source
Destination
Info
XXX.XX.XX.114
XXX.XX.XX.118

42810 > 15222 [SYN] Seq=0 Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSV=1973270934 TSER=0 WS=7
XXX.XX.XX.118

XXX.XX.XX.114
15222 > 42810 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSV=600337313 TSER=1973270934 WS=9
XXX.XX.XX.114
XXX.XX.XX.118

42810 > 15222 [ACK] Seq=1 Ack=1 Win=14720 Len=0 TSV=1973270934 TSER=600337313
XXX.XX.XX.114
XXX.XX.XX.118

42810 > 15222 [PSH, ACK] Seq=1 Ack=1 Win=14720 Len=102 TSV=1973270936 TSER=600337313
XXX.XX.XX.118

XXX.XX.XX.114
15222 > 42810 [ACK] Seq=1 Ack=103 Win=14848 Len=0 TSV=600337315 TSER=1973270936
XXX.XX.XX.118

XXX.XX.XX.114
15222 > 42810 [FIN, ACK] Seq=1 Ack=103 Win=14848 Len=0 TSV=600337316 TSER=1973270936
XXX.XX.XX.114
XXX.XX.XX.118

42810 > 15222 [ACK] Seq=103 Ack=2 Win=14720 Len=0 TSV=1973270937 TSER=600337316
XXX.XX.XX.114
XXX.XX.XX.118

42810 > 15222 [PSH, ACK] Seq=103 Ack=2 Win=14720 Len=56 TSV=1973270937 TSER=600337316
XXX.XX.XX.114
XXX.XX.XX.118

42810 > 15222 [FIN, PSH, ACK] Seq=159 Ack=2 Win=14720 Len=17 TSV=1973270937 TSER=600337316
XXX.XX.XX.118

XXX.XX.XX.114
15222 > 42810 [RST] Seq=2 Win=0 Len=0
XXX.XX.XX.118

XXX.XX.XX.114
15222 > 42810 [RST] Seq=2 Win=0 Len=0

Questions:

We noticed that this issue is getting resolved only when we are restating our client and then it managed to connect to OpenFire Server.

  • Can any one spread some light on this issue that we are having, and what are the required actions so that ConnectionListener.reconnectIn() will work.

Thanks Doron.

Here is the exception that the Smack client is catching:

public void reconnectionFailed(Exception arg0)

prints

Connection failed. No response from server.:

at org.jivesoftware.smack.PacketReader.startup(PacketReader.java:119)

at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:568)

at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection. java:527)

at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:953)

at org.jivesoftware.smack.ReconnectionManager$2.run(ReconnectionManager.java:128)

did you ever solve this problem?

Hi there,

Better late than never:

Could potentially be Openfire rejecting the login attmetp with the same resource name?

It is the login that fails or the connect?

Try checking the Openfire Server Settings -> Resource Policy and set the option Always kick

James