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

Tom Sheffler tom.sheffler at gmail.com
Tue Jul 24 21:18:40 MDT 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
command:

    /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.
-Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20120724/94cb3fa9/attachment-0001.html>


More information about the Twisted-Python mailing list