[Twisted-Python] 100% CPU on high opened descriptors

Glyph Lefkowitz glyph at twistedmatrix.com
Tue Apr 26 13:48:54 EDT 2011


On Apr 26, 2011, at 11:42 AM, Juan Antonio Ibañez Santorum wrote:

>    I have a Linux box serving my twisted app. All works ok except after some days running (where I can see my CPU going to 100%). I saw that CPU goes 100% usage when the app reaches to 1024 opened descriptors (sockets). It seems TM isn't closing some connections when clients loose connection to the server. I have no more than 200 simultaneous clients, each of then using a single connection. Any idea why those connections remain open?

This is a bug that somebody should really fix.  <http://tm.tl/816>

To work around it, however: if a connection is closed "uncleanly" (for example: you close your laptop, you rip the ethernet cable out of the wall, you foolishly give your computer to zooko for a minute), and no traffic is going in either direction, it will remain "open" as far as the server is concerned, forever.

If you send a little bit of traffic (an application-level ping) to each client every so often, the server's TCP stack will notice that nobody is acknowledging it and eventually time them out and close the connections.

Alternately, you could fix an even older bug, <http://tm.tl/78>, which would allow you to immediately terminate "dead" connections without waiting for them to time out.

Good luck,

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110426/c55ba49c/attachment.htm 


More information about the Twisted-Python mailing list