esl / MongooseIM

MongooseIM is Erlang Solutions' robust, scalable and efficient XMPP server, aimed at large installations. Specifically designed for enterprise purposes, it is fault-tolerant and can utilise the resources of multiple clustered machines.
Other
1.66k stars 426 forks source link

Offline message queue full due to chat state notification? #2715

Open theanhoo opened 4 years ago

theanhoo commented 4 years ago

MongooseIM version: 3.5.0 Installed from: source Erlang/OTP version: 20

Does MongooseIM (3.5.0) keep chat state notifications in the offline message queue? I kept getting this:

<message xmlns='jabber:client' to='me@somewhere.com/mobile' from='you@somewhere.com' id='b830b979-9d6d-40a6-9be3-c0ffb4331161' xml:lang='en' type='error'><error type='wait'><resource-constraint xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Your contact offline message queue is full. The message has been discarded.</text></error><body>Qwerty</body><item-type xmlns="chat.somewhere.com" type="1" mime-type="" /><markable xmlns='urn:xmpp:chat-markers:0'/><stanza-id xmlns='urn:xmpp:sid:0' id='B8R8FMSA5EO1' by='you@somewhere.com'/></message>, <error xmlns='jabber:client' type='wait'><resource-constraint xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Your contact offline message queue is full. The message has been discarded.</text></error>
<message xmlns='jabber:client' to='me@somewhere.com/mobile' from='you@somewhere.com' id='0cAuo-601' xml:lang='en' type='error'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error><composing xmlns='http://jabber.org/protocol/chatstates'/></message>, <error xmlns='jabber:client' type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>

Chat state notifications seem to causing the offline message queue to fill up really quick. Is there a way to turn this off in _modoffline using _unless_chatstate?

Many thanks in advance.

michalwski commented 4 years ago

Hi @theanhoo, thanks for contacting us.

It's hard to say if chat state notifications are the root cause of the full offline storage. The code responsible for storing offline messages tries to filter out chat state notifications but if the message stanza contains some other elements, other than just the chat state notification it may happen that such a stanza goes into the archive.

I suggest taking a look at all the messages which are in the full offline storage, you can do it in MongooseIM shell (mongooseimctl debug) by calling doing a call similar to the one:

mod_offline_backend:fetch_messages(<<"username">>, <<"the.domain.com">>).

Of course, username and the.domain.com from my example needs to be replaced with correct values for a user you know has full offline storage.