[Twisted-Python] intermittent problem: not accepting new connections

Jean-Paul Calderone exarkun at divmod.com
Thu Sep 11 08:44:36 MDT 2008

On Thu, 11 Sep 2008 15:38:06 +0100, Phil Mayers <p.mayers at imperial.ac.uk> wrote:
>Jean-Paul Calderone wrote:
>>On Thu, 11 Sep 2008 14:31:38 +0100, "Paul C. Nendick" 
>><paul.nendick at gmail.com> wrote:
>>>Not necessarily related to what you've described, but I'll share
>>>something that's helped a good deal on my most-heavily hit twisted
>>>servers. Presuming you're using Linux:
>>>echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
>>>from http://lartc.org/howto/lartc.kernel.obscure.html :
>>>"Enable fast recycling TIME-WAIT sockets. Default value is 1. It
>>>should not be changed without advice/request of technical experts"
>>>My expert advice: only use this on machines connected on a low-latency
>>>LAN. It *will* break internet-facing interfaces. It halves the
>>>constant used by the Nagle algorithm:
>>This is somewhat interesting.  It suggests a potential problem which
>>I hadn't thought about before.  If you need to accept more than about
>>64k connections (not necessarily concurrent) in less than TIME-WAIT
>>seconds, you might run out of ports.  Anyone know what happens to new
>>connection attempts to a server in this condition?
>Why would you run out of ports? accept()ed sockets use the same port as the 
>listen()ing socket.

Uh yes, I guess that would be a fatal flaw in this hypothesis.  Woops. :)


More information about the Twisted-Python mailing list