[ejabberd] 100 mb per c2s connection (+patch)

Anton Belyaev anton.belyaev at gmail.com
Mon Mar 30 21:36:58 MSD 2009


I've been investigating why ejabberd spends so much memory and found
out that some connections consumed >100 mb.

All the large connections were blocked on socket send operation.
Recently EJAB-746 was fixed, introducing a 15 sec timeout on socket
send. The problem has still remained for me, nevertheless. In
ejabberd_c2s module results of socket send are not examined at all, so
if client just does not read the socket, c2s process will block every
15 seconds on every message.

My application (component) sends a message to every user once 3
seconds. So, such client session will grow their message queue very
fast. And ejabberd crashed with out-of-mem.

To aid this I wrote a simple patch (attached), which drops session if
socket send times out.

Discussion: why results of socket send are not handled in ejabberd_c2s
at all? Or such errors are handled somewhere else?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ejabberd_c2.erl.r1931.patch
Type: text/x-diff
Size: 1778 bytes
Desc: not available
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20090330/f5453557/attachment.patch>

More information about the ejabberd mailing list