ortuman/jackal

XML error on login when reconnect from different network

Closed this issue · 5 comments

This was spotted on Xabber:
when you are connected on mobile data and reconnect to wifi, Xabber cannot login again due to
XML error on reconnect.

Normally it should reconnect and server should immediately disconnect previous connection and replace it with new one.

Could you please attach log file in debug mode?

Seems there's a problem related with the resource binding...

According to the RFC the server should behave as follow...

If there is a currently connected client whose session has the resourcepart being requested by the newly connecting client, the server MUST do one of the following (which of these the server does is a matter for implementation or local service policy, although suggestions are provided below).

  • Override the resourcepart provided by the newly connecting client with a server-generated resourcepart. This behavior is encouraged, because it simplifies the resource binding process for client implementations.
  • Disallow the resource binding attempt of the newly connecting client and maintain the session of the currently connected client. This behavior is neither encouraged nor discouraged, despite the fact that it was implicitly encouraged in RFC 3920; however, note that handling of the error is unevenly supported among existing client implementations, which often treat it as an authentication error and have been observed to discard cached credentials when receiving it.
  • Terminate the session of the currently connected client and allow the resource binding attempt of the newly connecting client. Although this was the traditional behavior of early XMPP server implementations, it is now discouraged because it can lead to a never-ending cycle of two clients effectively disconnecting each other; however, note that this behavior can be appropriate in some deployment scenarios or if the server knows that the currently connected client has a dead connection or broken stream as described under Section 4.6.

Planning to add a new configuration option resource_conflict that allows to configure this behaviour accordingly.

this is exactly it:

Terminate the session of the currently connected client and allow the resource binding attempt of the newly connecting client.

specially in scenario of:

can be appropriate in some deployment scenarios or if the server knows that the currently connected client has a dead connection or broken stream

It is exactly like that, dead connection should be allowed to replace, that was this issue about in the first place.

Planning to add a new configuration option resource_conflict that allows to configure this behaviour accordingly.

@ortuman Thanks man.

Added option 'resource_conflict' in 0.1.8 relese.

Valid values are:
override - override the resource with a server-generated resourcepart.
replace - terminate the session of the currently connected client.
reject - disallow resource binding attempt.