[Twisted-Python] Twisted Consumes 100% CPU

Thomas Hervé therve at free.fr
Sun Feb 24 06:17:49 EST 2008


Matthew Glubb a écrit :
> Hi All,
>
> Hope you are all enjoying your weekends.
>
> I have a simple twisted proxy server, obviously passed on 
> twisted.web.proxy. Periodically, it makes a call to a MySQL database, 
> using adbapi.ConnectionPool.
>
> When I initially boot the server, I see traffic going through the 
> proxy and everything works fine, twistd consumes less than 5% CPU. I 
> return 24 hours later, the server is still responsive (ie. functions 
> fine) but it consumes 100% of the CPU.
>
> I have only noticed this behaviour since I added the db connection via 
> adbapi. I assume, because the proxy still functions well that the 
> threads in the adbapi pool are working overtime.
>
> When I manhole in to the server, gc.collect() shows objects are being 
> cleaned up, and gc.garbage reports nothing.
>
> I am running Twisted 2.5, Python 2.5.1, Linux 2.6, epoll, MySQL 5.0.51a.
>
> Does anyone have any experience of this problem? Is there an easy 
> workaround?
Unfortunately, this is a known problem with epoll on Twisted 2.5. 
Fortunately, this has been fixed in trunk. You can see more informations 
at http://twistedmatrix.com/trac/ticket/2809. There is different 
workaround for Twisted 2.5, either by backporting epollreactor from 
trunk, or applying one of the small patch proposed.

-- 
Thomas




More information about the Twisted-Python mailing list