[Twisted-Python] Anyone seeing hanging of Twisted HTTPS servers?

James Y Knight foom at fuhm.net
Thu May 19 10:50:33 MDT 2005


On May 19, 2005, at 12:20 PM, Mike C. Fletcher wrote:

> Regarding systrace, I'd love to, but so far I've not been able to  
> catch
> the dratted thing in the condition more than once or twice, and it's
> normally almost finished the hang by the time I get around to  
> working on
> it.  Suppose I should just sit here watching it for a few hours, or  
> rig
> up a monitor of some form.
>

I think it's probably more likely that it's not hanging in C code at  
all, but in a bit of application python code. What I'd do is add a  
"watchdog" timer, something like this. Of course, this won't work if  
it's blocking in a C call somewhere because the python signal handler  
won't be called until the C call returns. But even that might give  
you some useful information on what the problem is.

import signal, pdb, sys
from twisted.internet import task

def timeout(*args):
   sys.stderr.write("SIGALRM timeout, breaking into debugger.\n")
   import pdb; pdb.set_trace()

signal.signal(signal.SIGALRM, timeout)

task.LoopingCall(signal.alarm, 10).start(1)

James




More information about the Twisted-Python mailing list