[Twisted-Python] epoll reactor problems

Andrew Bennetts andrew-twisted at puzzling.org
Wed Apr 11 21:00:13 EDT 2007


Alec Matusis wrote:
> I am now suspecting there is something strange with Twisted 2.5:
> 
> Both servers now show 99.9% CPU using top:

It would be nice to know where in the code it is spending all that time.

I would consider installing the debug symbols for python, and getting a C and
python backtrace with gdb.  (use the .gdbinit file from
http://svn.python.org/view/python/trunk/Misc/gdbinit?rev=39492&view=auto to get
the "pystack" gdb command, you may need the patch to it from
http://jcalderone.livejournal.com/28224.html too).

Or maybe even install a simple SIGUSR1 signal handler than dumps a backtrace,
and send SIGUSR1 to your process repeatedly while it's at 99.9% CPU.  Or a
SIGUSR1 handler to install a trace hook (like the twistd --spew option does).

The idea either way is to find out by random sampling what code is executing;
presumably it's doing the same redundant work over and over, so it shouldn't
take many samples to find one code path that is occurring frequently.

Then hopefully that extra information will hint at what the problem is.

-Andrew.





More information about the Twisted-Python mailing list