[ejabberd] Losing messages to dead connections

Konstantin Khomoutov flatworm at users.sourceforge.net
Mon Mar 24 10:34:35 MSK 2014


On Sat, 22 Mar 2014 18:32:44 +0000
Raoul Duke <rduke496 at gmail.com> wrote:

[...]
> 1] User A is messaging User B via their mobiles.
> 2] User B loses all connectivity, so client can't disconnect from
> server. 3] ejabberd still lists User B as online.
> 4] Since ejabberd assumes User B is still online, any message from
> User A gets passed on to the dead connection.
> 5] So user B won't get the message, nor does it get saved as an
> offline message, as ejabberd assumes the user is online.
> 6] Message lost.
> 
> Until ejabberd realises that the connection is stale, it treats it as
> an online user.
[...]
> BTW, I realize that xep-0198 would probably be a much better solution
> to this and I plan to test the new patch but for the meantime I am
> trying to mitigate this with mod_ping.
> 
> The issue with mod_ping however, as the above post also points out, is
> that the 32 second timeout for receiving pongs is quite long in the
> context of this message black-holing problem.  I would like to lower
> the window of potentially black-holed messages.  Am I correct in
> assuming that this is the best I can do (in lieu of something like
> xep-0198?).

You might consider using [1] "Message Delivery Receipts" -- it's
client-only message delivery acknowledgement mechanism.  The upside
is that no server-side support is required; the downside is that
each message stanza sent produces another one coming back which is
bandwidth wasting.  And of course, in order for this to work, both
clients have to support this extension.

[...]
> "I created a mod and hooked up to the send_packet and receive_packet
> events. Save the message ID to a table. Start a 10 sec waiting thread.
> If the receive_packet hook gets the message ID back under 10 sec I
> kill the thread, else I manually store the message in the offline
> table. Worst case now is, I might have the msg twice in the offline
> table. But it will have the same ID, our clients know not to duplicate
> messages. - Johan Vorster Dec 12 '13 at 16:49"
> 
> This sounds like a bit of a kludge but it also sounds like it may be
> an effective one.  Does this sound viable?  Does anyone know or have
> any mod already implemented like this?  It isn't clear to me in the
> user_receive_packet how I could interrogate the MessageID, can someone
> send me a pointer/example of this?
[...]

I'd say this is really a kludge: the user might legitimately not send
any messages for more than 10 seconds.  Or do you mean this kludge is
supposed to work along with mod_ping thus forcing a lower timeout?

P.S.
Holger Weiss is working on implementing XEP-0198 for ejabberd [2]; you
might be interested to get in touch with him [3].

1. http://xmpp.org/extensions/xep-0184.html
2. http://chatlogs.jabber.ru/ejabberd@conference.jabber.ru/2014/03/20.html#13:27:06.183120
3. https://github.com/weiss/ejabberd


More information about the ejabberd mailing list