Hello.

I have one XMPP server in production (approx 1.5k simultaneous connections from 170k users), running the latest jabberd2 from Ubuntu's repos (this one : http://packages.ubuntu.com/precise/net/jabberd2).

At first, we had to face "ghost connections" (from users not properly disconnecting). To solve that, I changed c2s.xml to have
  <check>
      <interval>600</interval>
      <idle>0</idle>
      <keepalive>600</keepalive>
    </check>
So "unplugged" connections will be closed correctly after 10min. It solved the problem.

But yesterday, in our system logs, I saw a step in established connections : +500 connections in a few seconds. In c2s.log I found approx. 500 connections from one IP (probably a bug in client or malicious attempt), with 500 lines like :

Thu Jan  3 20:24:41 2013 [notice] [700] [XXX.XXX.XXX.XXX, port=2090] connect
Thu Jan  3 20:24:41 2013 [notice] [737] [XXX.XXX.XXX.XXX, port=2091] connect
Thu Jan  3 20:24:41 2013 [notice] [786] [XXX.XXX.XXX.XXX, port=2092] connect
Thu Jan  3 20:24:41 2013 [notice] [794] [XXX.XXX.XXX.XXX, port=2093] connect
Thu Jan  3 20:24:41 2013 [notice] [796] [XXX.XXX.XXX.XXX, port=2094] connect
Thu Jan  3 20:24:41 2013 [notice] [798] [XXX.XXX.XXX.XXX, port=2095] connect
....

Is goes on for 10s, then stops 10s, then they all disconnect :

Thu Jan 3 20:25:03 2013 [notice] [1482] [XXX.XXX.XXX.XXX, port=2740] disconnect jid=unbound, packets: 0 Thu Jan 3 20:25:03 2013 [notice] [1486] [XXX.XXX.XXX.XXX, port=2744] disconnect jid=unbound, packets: 0 Thu Jan 3 20:25:03 2013 [notice] [1490] [XXX.XXX.XXX.XXX, port=2748] disconnect jid=unbound, packets: 0 Thu Jan 3 20:25:03 2013 [notice] [1494] [XXX.XXX.XXX.XXX, port=2752] disconnect jid=unbound, packets: 0 Thu Jan 3 20:25:03 2013 [notice] [1498] [XXX.XXX.XXX.XXX, port=2756] disconnect jid=unbound, packets: 0 Thu Jan 3 20:25:03 2013 [notice] [1502] [XXX.XXX.XXX.XXX, port=2760] disconnect jid=unbound, packets: 0
....

My problem is that I still can see the 500 established connections (netstat -n | grep 'XXX.XXX.XXX.XXX'). Even if this "connection spam" occurred yesterday (long enough for <keepalive> to do its job)

To prevent this to happen again, I have changed c2s.xml to
 <io>
     <limits>
        <connects>10</connects>
  </limits>
  </io>

But if I understand correctly, it should only decrease the number of created connections, and it would not prevent them from being kept established even when unnecessary. I've looked at the code, and I think 0-packet connections are properly added to c2s->dead_sess (and thus should be cleaned). I couldn't find any problem, but yet I'm not very familiar with this code.

Is there a configuration item that I missed to prevent that ? Is it a bug that has been fixed since but not yet corrected in Ubuntu's repos ?

Thanks in advance for any help. Apart from that, the server is doing great : very low resources consumption. ^_^

--
Sylvain "Gugli" Guglielmi
Gamedev@Nadeo@Ubisoft

Reply via email to