[Twisted-Python] Capture blocking calls?

Ian Duggan ian at ianduggan.net
Thu Jun 16 12:56:23 EDT 2005


On Tuesday 14 June 2005 18:17, Jp Calderone wrote:
> >Does anyone know of any tools that could be used to wrap a python module
> > and capture/report blocking calls made by it?
>
> <http://svn.twistedmatrix.com/cvs/sandbox/exarkun/btt.py> (and
> <http://svn.twistedmatrix.com/cvs/sandbox/exarkun/test_btt.py>) might be of
> interest/use.  I haven't done much with it yet, so I don't know if it's
> actually effective.  I'd be interested to hear if you have any luck with
> it.

Heh, this is a very clever trick, setting and disabling an alarm in a looping 
call. If it doesn't get disabled in time, it tells you where the stack is. It 
actually works great! I was able to immediately test it by suspending twisted 
for a moment.

I had to tune the precisions it was using, to prevent it from firing 
spuriously when my laptop got busy, but otherwise it's very cool. I love 
simple.

Suggestions for anyone else who uses this:

1) Tune the precisions so that you have a quiet baseline.

2) If the network you are interacting with is too fast, find a way to throttle 
your connection. 

http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Adv-Routing-HOWTO.html

--Ian




More information about the Twisted-Python mailing list