<div dir="ltr">We had a similar problem like this, might as well share it with you guys:<br><br>Our Jabber server stopped taking in new connections due to our iptables at some point in time (even lost some packets). We have an ip routing scheme where ports 25,80,5223,10873 routed to 5222. Whenever this happens, we get error error from our syslogs:<br>
<br>&quot;&quot;ip_conntrack: table full, dropping packet&quot;<br><br><a href="http://support.imagestream.com/Resolving_ip_conntrack_table_full_Errors.html">http://support.imagestream.com/Resolving_ip_conntrack_table_full_Errors.html</a><br>
<br>Might as well check dmesg if you have something like this. What we did is disable iptables and removed its kernel modules.<br><br><div class="gmail_quote">On Fri, Sep 12, 2008 at 3:57 AM, Alec Matusis <span dir="ltr">&lt;<a href="mailto:matusis@yahoo.com">matusis@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">&gt; How does ulimit -a compare between old and new machine?<br>
<br>
</div>ulimit is only higher on the new machine, I upped it. Also, from my<br>
experience, running into &nbsp;ulimits produces log messages.<br>
<br>
alecm@serv2 ~&gt; cat /proc/23678/limits<br>
<br>
Limit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Soft Limit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hard Limit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Units<br>
<br>
Max cpu time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ms<br>
<br>
Max file size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bytes<br>
<br>
Max data size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bytes<br>
<br>
Max stack size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8388608 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bytes<br>
<br>
Max core file size &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bytes<br>
<br>
Max resident set &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1073741824 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1073741824 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bytes<br>
<br>
Max processes &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 126976 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 126976<br>
processes<br>
Max open files &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;25000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;25000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;files<br>
<br>
Max locked memory &nbsp; &nbsp; &nbsp; &nbsp; 32768 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;32768 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bytes<br>
<br>
Max address space &nbsp; &nbsp; &nbsp; &nbsp; unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bytes<br>
<br>
Max file locks &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unlimited &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;locks<br>
<br>
Max pending signals &nbsp; &nbsp; &nbsp; 126976 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 126976 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; signals<br>
<br>
Max msgqueue size &nbsp; &nbsp; &nbsp; &nbsp; 819200 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 819200 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bytes<br>
<br>
Max nice priority &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0<br>
Max realtime priority &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0<br>
<div class="Ih2E3d"><br>
<br>
&gt; If you need to accept more than about<br>
&gt; 64k connections (not necessarily concurrent) in less than TIME-WAIT<br>
&gt; seconds, you might run out of ports.<br>
<br>
</div><div class="Ih2E3d">&gt; How does netstat look like?<br>
<br>
</div>I have to wait for another outage tonight, to get more definite results on<br>
this.<br>
So far, I have had only one very brief outage at 7:46am<br>
I was asleep, but I have some new data logged.<br>
I have two servers, one on port 5222 (problematic one, let&#39;s call it serv1<br>
), and one on 5228 (that has no problems, call it serv2 ).<br>
I made a script that measures the number of connections on each type of<br>
server respectively like this:<br>
<br>
while [ 1 ]<br>
do<br>
&nbsp;sleep 5<br>
&nbsp;netstat -ant | grep ESTABLISHED | awk &#39;/:5228 /{a += 1}/:5222 /{b += 1} END<br>
{print strftime(&quot; %d %b %Y %H:%M:%S&quot;, systime(<br>
))&quot; &nbsp; serv2: &quot;a&quot; &nbsp; serv1: &quot;b&quot; total: &quot;a+b }&#39;<br>
done<br>
<br>
This is what happened around 7:46am (lines that have &quot;+&quot; in front indicate<br>
anomaly):<br>
<br>
&nbsp;11 Sep 2008 07:41:29 &nbsp; serv2: 2756 &nbsp; serv1: 1064 total: 3820<br>
&nbsp;11 Sep 2008 07:41:36 &nbsp; serv2: 2764 &nbsp; serv1: 1062 total: 3826<br>
&nbsp;11 Sep 2008 07:41:44 &nbsp; serv2: 2784 &nbsp; serv1: 1049 total: 3833<br>
&nbsp;11 Sep 2008 07:41:51 &nbsp; serv2: 2756 &nbsp; serv1: 1055 total: 3811<br>
&nbsp;11 Sep 2008 07:41:59 &nbsp; serv2: 2760 &nbsp; serv1: 1066 total: 3826<br>
&nbsp;11 Sep 2008 07:42:06 &nbsp; serv2: 2777 &nbsp; serv1: 1050 total: 3827<br>
&nbsp;11 Sep 2008 07:42:14 &nbsp; serv2: 2769 &nbsp; serv1: 1054 total: 3823<br>
&nbsp;11 Sep 2008 07:42:21 &nbsp; serv2: 2751 &nbsp; serv1: 1055 total: 3806<br>
&nbsp;11 Sep 2008 07:42:29 &nbsp; serv2: 2760 &nbsp; serv1: 1050 total: 3810<br>
&nbsp;11 Sep 2008 07:42:36 &nbsp; serv2: 2747 &nbsp; serv1: 1040 total: 3787<br>
&nbsp;11 Sep 2008 07:42:44 &nbsp; serv2: 2737 &nbsp; serv1: 1046 total: 3783<br>
&nbsp;11 Sep 2008 07:42:51 &nbsp; serv2: 2739 &nbsp; serv1: 1046 total: 3785<br>
&nbsp;11 Sep 2008 07:42:59 &nbsp; serv2: 2743 &nbsp; serv1: 1037 total: 3780<br>
&nbsp;11 Sep 2008 07:43:07 &nbsp; serv2: 2720 &nbsp; serv1: 1041 total: 3761<br>
&nbsp;11 Sep 2008 07:43:14 &nbsp; serv2: 2714 &nbsp; serv1: 1047 total: 3761<br>
&nbsp;11 Sep 2008 07:43:22 &nbsp; serv2: 2721 &nbsp; serv1: 1045 total: 3766<br>
&nbsp;11 Sep 2008 07:43:29 &nbsp; serv2: 2697 &nbsp; serv1: 1056 total: 3753<br>
&nbsp;11 Sep 2008 07:43:37 &nbsp; serv2: 2710 &nbsp; serv1: 1059 total: 3769<br>
+11 Sep 2008 07:43:44 &nbsp; serv2: 2765 &nbsp; serv1: 1304 total: 4069<br>
+11 Sep 2008 07:43:53 &nbsp; serv2: 2854 &nbsp; serv1: 1904 total: 4758<br>
+11 Sep 2008 07:44:01 &nbsp; serv2: 2714 &nbsp; serv1: 2190 total: 4904<br>
+11 Sep 2008 07:44:09 &nbsp; serv2: 2715 &nbsp; serv1: 2202 total: 4917<br>
+11 Sep 2008 07:44:17 &nbsp; serv2: 2779 &nbsp; serv1: 1891 total: 4670<br>
+11 Sep 2008 07:44:26 &nbsp; serv2: 2812 &nbsp; serv1: 2284 total: 5096<br>
+11 Sep 2008 07:44:36 &nbsp; serv2: 2828 &nbsp; serv1: 3496 total: 6324<br>
+11 Sep 2008 07:44:46 &nbsp; serv2: 2715 &nbsp; serv1: 4327 total: 7042<br>
+11 Sep 2008 07:44:56 &nbsp; serv2: 2638 &nbsp; serv1: 3499 total: 6137<br>
+11 Sep 2008 07:45:05 &nbsp; serv2: 2714 &nbsp; serv1: 2396 total: 5110<br>
+11 Sep 2008 07:45:15 &nbsp; serv2: 2776 &nbsp; serv1: 1464 total: 4240<br>
+11 Sep 2008 07:45:25 &nbsp; serv2: 2728 &nbsp; serv1: 1604 total: 4332<br>
+11 Sep 2008 07:45:35 &nbsp; serv2: 2708 &nbsp; serv1: 1566 total: 4274<br>
+11 Sep 2008 07:45:45 &nbsp; serv2: 2750 &nbsp; serv1: 1680 total: 4430<br>
+11 Sep 2008 07:45:54 &nbsp; serv2: 2755 &nbsp; serv1: 1311 total: 4066<br>
+11 Sep 2008 07:46:04 &nbsp; serv2: 2704 &nbsp; serv1: 1178 total: 3882<br>
&nbsp;11 Sep 2008 07:46:13 &nbsp; serv2: 2644 &nbsp; serv1: 1024 total: 3668<br>
&nbsp;11 Sep 2008 07:46:22 &nbsp; serv2: 2573 &nbsp; serv1: 981 total: 3554<br>
&nbsp;11 Sep 2008 07:46:30 &nbsp; serv2: 2739 &nbsp; serv1: 1051 total: 3790<br>
&nbsp;11 Sep 2008 07:46:39 &nbsp; serv2: 2773 &nbsp; serv1: 1043 total: 3816<br>
&nbsp;11 Sep 2008 07:46:46 &nbsp; serv2: 2548 &nbsp; serv1: 959 total: 3507<br>
&nbsp;11 Sep 2008 07:46:54 &nbsp; serv2: 2773 &nbsp; serv1: 1044 total: 3817<br>
&nbsp;11 Sep 2008 07:47:02 &nbsp; serv2: 2745 &nbsp; serv1: 1027 total: 3772<br>
&nbsp;11 Sep 2008 07:47:10 &nbsp; serv2: 2591 &nbsp; serv1: 960 total: 3551<br>
&nbsp;11 Sep 2008 07:47:17 &nbsp; serv2: 2721 &nbsp; serv1: 1002 total: 3723<br>
&nbsp;11 Sep 2008 07:47:25 &nbsp; serv2: 2753 &nbsp; serv1: 1030 total: 3783<br>
&nbsp;11 Sep 2008 07:47:32 &nbsp; serv2: 2773 &nbsp; serv1: 1029 total: 3802<br>
&nbsp;11 Sep 2008 07:47:40 &nbsp; serv2: 2768 &nbsp; serv1: 1025 total: 3793<br>
&nbsp;11 Sep 2008 07:47:47 &nbsp; serv2: 2764 &nbsp; serv1: 1021 total: 3785<br>
&nbsp;11 Sep 2008 07:47:55 &nbsp; serv2: 2750 &nbsp; serv1: 1021 total: 3771<br>
<br>
<br>
Each server also reports the maximum numbers of authenticated connected<br>
clients to the database.<br>
Even though serv1 peaked at 07:44:46 &nbsp;at 4327 &quot;ESTABLISHED&quot; connections, the<br>
number of normally authenticated clients in the database for this time<br>
period is only 1100, which does not reflect this weird connections spike.<br>
Since I was asleep at 7:46am, I did not have a chance to investigate what<br>
those connections actually were.<br>
<div class="Ih2E3d"><br>
&gt; Anyone know what happens to new<br>
&gt; connection attempts to a server in this condition?<br>
<br>
</div>One thing that I noticed yesterday, that when server was in this condition,<br>
telnet simply hang, as if no ACK packet was received back:<br>
<br>
alecm@serv2 ~&gt; telnet localhost 5222<br>
<div class="Ih2E3d">Trying 127.0.0.1...<br>
<br>
</div>and nothing<br>
<br>
This behavior or telnet seems to be unique to the case when ACK is not<br>
received in the handshake, I verified that with tcpdump. To contrast that,<br>
if nothing listens on the destination port for example, telnet gives:<br>
<br>
alecm@serv2 ~&gt; telnet localhost 50007<br>
<div class="Ih2E3d">Trying 127.0.0.1...<br>
</div>telnet: connect to address <a href="http://127.0.0.1" target="_blank">127.0.0.1</a>: Connection refused<br>
telnet: Unable to connect to remote host: Connection refused<br>
<br>
which corresponds to RST packet that kernel returns in that case.<br>
I tried to write a 5 line mucked up server with accept() not returning any<br>
packets, and failed.<br>
<div class="Ih2E3d"><br>
&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:twisted-python-bounces@twistedmatrix.com">twisted-python-bounces@twistedmatrix.com</a> [mailto:<a href="mailto:twisted-python-">twisted-python-</a><br>
&gt; <a href="mailto:bounces@twistedmatrix.com">bounces@twistedmatrix.com</a>] On Behalf Of Jean-Paul Calderone<br>
</div><div class="Ih2E3d">&gt; Sent: Thursday, September 11, 2008 6:47 AM<br>
&gt; To: Twisted general discussion<br>
</div><div class="Ih2E3d">&gt; Subject: Re: [Twisted-Python] intermittent problem: not accepting new<br>
&gt; connections<br>
&gt;<br>
</div><div><div></div><div class="Wj3C7c">&gt; On Thu, 11 Sep 2008 14:31:38 +0100, &quot;Paul C. Nendick&quot;<br>
&gt; &lt;<a href="mailto:paul.nendick@gmail.com">paul.nendick@gmail.com</a>&gt; wrote:<br>
&gt; &gt;Not necessarily related to what you&#39;ve described, but I&#39;ll share<br>
&gt; &gt;something that&#39;s helped a good deal on my most-heavily hit twisted<br>
&gt; &gt;servers. Presuming you&#39;re using Linux:<br>
&gt; &gt;<br>
&gt; &gt; echo 1 &gt; /proc/sys/net/ipv4/tcp_tw_recycle<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;from <a href="http://lartc.org/howto/lartc.kernel.obscure.html" target="_blank">http://lartc.org/howto/lartc.kernel.obscure.html</a> :<br>
&gt; &gt;<br>
&gt; &gt;&quot;Enable fast recycling TIME-WAIT sockets. Default value is 1. It<br>
&gt; &gt;should not be changed without advice/request of technical experts&quot;<br>
&gt; &gt;<br>
&gt; &gt;My expert advice: only use this on machines connected on a low-latency<br>
&gt; &gt;LAN. It *will* break internet-facing interfaces. It halves the<br>
&gt; &gt;constant used by the Nagle algorithm:<br>
&gt; &gt;<br>
&gt; &gt;<a href="http://en.wikipedia.org/wiki/Nagle%27s_algorithm" target="_blank">http://en.wikipedia.org/wiki/Nagle&#39;s_algorithm</a><br>
&gt; &gt;<br>
&gt;<br>
&gt; This is somewhat interesting. &nbsp;It suggests a potential problem which<br>
&gt; I hadn&#39;t thought about before. &nbsp;If you need to accept more than about<br>
&gt; 64k connections (not necessarily concurrent) in less than TIME-WAIT<br>
&gt; seconds, you might run out of ports. &nbsp;Anyone know what happens to new<br>
&gt; connection attempts to a server in this condition?<br>
&gt;<br>
&gt; Alec, any idea if your server could be getting into this state every<br>
&gt; once in a while? &nbsp;This is an appealing hypothesis, since it wouldn&#39;t<br>
&gt; necessarily happen at peak connection time (but potentially shortly<br>
&gt; after a peak), would resolve itself given a short period of time,<br>
&gt; wouldn&#39;t necessarily prevent all new connection attempts, since old<br>
&gt; TIME-WAIT sockets would be gradually timing out (so your other low-<br>
&gt; volume servers might still appear to be working normally), wouldn&#39;t<br>
&gt; interfere with already established connections, and might not change<br>
&gt; the userspace-visible syscall behavior (depending on what Linux does<br>
&gt; in this case, but I wouldn&#39;t be surprised if connection failures due<br>
&gt; to this never showed up in an accept(2) result).<br>
&gt;<br>
&gt; Jean-Paul<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Twisted-Python mailing list<br>
&gt; <a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
&gt; <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.alvinatorsplayground.blogspot.com/">http://www.alvinatorsplayground.blogspot.com/</a><br>
</div>