Messages are not stored after SM session timeout expiring

Natale Vinto
Added about 4 years ago


I'm sending AMP messages with stream management active to bare JIDs, on a fresh tigase 7.0.0 nightly build, but what I found out is that if the stream resumption doesn't happens within the SM session expire, the server keep the message in RAM, instead of storing to the DB. And if the client connects with a new session ID, the message is lost. The scenario is about clients unable to announce correctly their unvailability by Presence due network faults and sometimes unable to resume the stream (client crash, etc). How to ensure that the message would be stored after SM session id timeout expiring?

From log I see some spare message like this:

2015-01-14 15:03:07.015 [in_0-amp]         JDBCMsgRepository.storeMessage()   FINEST:   Storring expired: 1/16/15 4:03 PM message: <message id="aBcDe-1" from="" to="" xmlns="jabber:client"><subject>Test</subject><body>Test</body><amp xmlns=""><rule condition="expire-at" action="error" value="2015-01-16T16:03:05Z"/><rule condition="match-resource" action="error" value="other"/></amp><delay stamp="2015-01-14T15:03:07.015Z" from="" xmlns="urn:xmpp:delay">Offline Storage</delay></message>

but it doesn't happens all the time and sure it doesn't happens after the SM session ID default timeout of 60 s expires.

P.S. I've seen from log also some "impossible happened" as in this previous thread

Replies (4)


Added by Artur Hefczyc TigaseTeam about 4 years ago

For the problem with expired messages not stored, I think Andrzej is the best person to help.

As for the "impossible happened" this needs to be properly investigated. I cannot say anything more, especially that a custom code is deployed on the installation.

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

Messages sent to bare JIDs should be stored to offline store, but if messages is processed by server and more than one resource is connected for particular user then message sent to bare JID will not be stored as it was delivered properly to other connection. This is the same behavior as when message would be processed by server but only other resource would be connected.

Added by Natale Vinto about 4 years ago

Hi Andrzej,

the resource is unique for the XMPP user, I mean there isn't ever any other

resource connected for the same user.

Should the message been stored exactly after SM session timeout comes?

Is it indipendent by any AMP rule or it should declared properly?

I see that message stay in RAM until a resume session comes, otherwise is


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

When StreamManagement session comes out, messages which were not ACK as delivered by StreamManagement are sent marked as delivery-error to SessionManager which process them once again. SessionManager using processors check if message was sent to barejid and not other connection for this user is active at this point it stores this messages in offline store.

However in rare cases it might be possible that if StreamManagement resuption will not timeout or fail but client during this timeout would authenticate new connection then SessionManager would assume that there is other connection for which messages was delivered (as other - newly established connection - will be available).