[Twisted-Python] stopping a twistd daemon: SIGTERM or SIGKILL

Tom Sheffler tom.sheffler at gmail.com
Tue Jul 24 23:18:40 EDT 2012

Hi Twisted Folks,

We use monit to start and stop our twistd daemons.  I have set up monit to
restart some of the daemons when they grow too large.  I use the following

    /bin/bash -c 'kill -s SIGTERM `cat /var/run/sensrtunw/sensrtunw.pid`'

Occasionally, this is unsuccessful in killing the twistd process, and I
need to use a SIGKILL manually as a last resort.

Any ideas why?

I believe the SIGTERM method will do a clean shutdown, calling the
appropriate stopService methods.  This would be the preferred method.

The only thing that comes to mind is that the process does have a very few
threads ... I believe these are the database connections.  Could there be a
race condition that prevents twistd from stopping?  Shall I simply use
SIGKILL in all cases?

Suggestions or comments appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120724/94cb3fa9/attachment.htm 

More information about the Twisted-Python mailing list