Uploaded image for project: 'ejabberd development'
  1. ejabberd development
  2. EJAB-926

Drop c2s connection if socket send times out



      Quote of Anton Belyaev from the ejabberd mailing list thread: 100 mb per c2s connection (+patch)

      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.

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

      The send timeout socket option in trunk helps if client does not read the socket. But, if the client receives messages more often than timeout (15 sec), the client's process heap will grow still.

      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. The patch is against r1931 of trunk.

        Issue Links




              • Votes:
                2 Vote for this issue
                2 Start watching this issue


                • Created: