AnsweredAssumed Answered

Smack 4.2.0 closes connection on receiving <stream:error> - conflict and prevent further attempt log in..

Question asked by cmeng on May 14, 2017
Latest reply on May 15, 2017 by cmeng

Per XEP-0078: Non-SASL Authentication recommendation, when connection conflict occur is stated below:


"There is a resource conflict (i.e., there is already an active session with that resource identifier associated with the same username). The RECOMMENDED behavior is for the server to terminate the existing session and create the new one; however, the server MAY provide the opposite behavior if desired, leading to a conflict error for the newly requested login."


With ejabberd, the server will inform the client of the session conflict; but proceed to terminate and re-create a new session. However Smack 4.2.0 automatically closes the connection upon receiving this <stream:error/>-conflict. After this, the server and client connection state is no more in-sync. This has prevented the client attempt to re-login as the same <stream:error/> will again be issued by the server.



05-15 12:47:08.148 D/SMACK: RECV (0): <stream:error><conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Replaced by new connection</text></stream:error>

05-15 12:47:08.273 W/αTalk: [9] org.jivesoftware.smack.AbstractXMPPConnection.callConnectionClosedOnErrorListen er() Connection XMPPTCPConnection[] (0) closed with error

                            org.jivesoftware.smack.XMPPException$StreamErrorException: conflict You can read more about the meaning of this stream error at

                            <stream:error><conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en'>Replaced by new connection</text></stream:error>

                                at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC

                                at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon

                                at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$