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

Anton Belyaev anton.belyaev at gmail.com
Thu Apr 16 14:06:51 MSD 2009

Hello Mickael,

Yep, I meant the current trunk (ejabberd 2.1). The patch is against
r1931 of trunk.

The send timeout socket option presents in trunk now.
It really helps if client does not read the socket.

But, if the client receives messages more offen than timeout (15 sec),
the client's process heap will grow still.
And the patch is to aid this scenario.

So, just to clarify: the disconnect in this case this is still going
to be implemented in 2.1, right?


2009/3/30 Mickael Remond <mickael.remond at process-one.net>:
> Hello Anton,
> The socket send timeout and disconnection features was only going to be
> pushed in ejabberd 2.1, because the send timeout API require a recent
> Erlang R12 version.
> Fully supporting that API will require dropping support for Erlang R11.
> This is the type of thing we have pushed to customer however that have
> made the switch to R12 and that will go into 2.1 version.
> Anton Belyaev wrote:
>> Hello,
>> 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?
>> Thanks.
>> Anton.

More information about the ejabberd mailing list