Error "The user connection is no longer active" when using XEP-0198: Stream Management

Igor Khomenko
Added over 4 years ago

I'm trying to use XEP-0198: Stream Management with Tigase 5.2, but sometimes getting an error "The user connection is no longer active" and NullPointerException in logs

Here is my scenario:

  • User1 connected and logged in to Chat, enabled Stream Management

  • User1 sent a message to User2

  • User1 sent a **** element and received ****

  • User1 closed app, but did not logout properly (close stream, close TCP connection)


  • User2 connected and logged in to Chat, enabled Stream Management

  • User2 received a message from offline storage

  • User2 sent a message to User1

  • User2 got this error:

<error code="404" type="cancel"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></item-not-found><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" lang="en">The user connection is no longer active.</text></error>

and server exception

    at tigase.server.xmppclient.StreamManagementIOProcessor.packetsSent(
    at tigase.xmpp.XMPPIOService.processWaitingPackets(
    at tigase.server.ConnectionManager.writePacketToSocket(
    at tigase.server.ConnectionManager.writePacketToSocket(
    at tigase.server.xmppclient.ClientConnectionManager.processPacket(
    at tigase.server.AbstractMessageReceiver$

Does it an expected behaviour? I didn't find anything about such error here

Replies (4)


Added by Artur Hefczyc TigaseTeam over 4 years ago

I filed bug report for you: #2129 and added you to the watchers for the ticket. You will be notified about any updates.


Added by Artur Hefczyc TigaseTeam over 4 years ago

Apparently as you can read in the ticket comments, the problem has been fixed in recent code.

Added by Igor Khomenko over 4 years ago


so, now I receive an error when trying to send a message to User with broken connection.

Actually it's much better than receive nothing and lose a message completely

Am I right that in 5.3 I I won't be receiving an error message, but it will be stored to the Offline storage?

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 4 years ago

Yes, this returned error, which you are receiving right now is correct behavior of Tigase XMPP Server 5.2

In Tigase XMPP Server 5.3 logic responsible for handling not delivered messages is changed and will handle packets not delivered due to broken connection in same way as they were sent to offline user. By default Tigase XMPP Server stores messages sent to offline user in offline storage, so your not delivered messages are going to be stored in offline storage as well.