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

Justin Venus justin.venus at gmail.com
Tue Jul 24 23:28:21 EDT 2012

I experienced a similar issue with a rather large twisted daemon.  I ended
up installing my own signal handler and issued a triggerSystemEvent to stop
the twisted services.  I can point you towards my code if you want to
pursue that route.

Justin Venus
On Jul 24, 2012 10:21 PM, "Tom Sheffler" <tom.sheffler at gmail.com> wrote:

> 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
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120724/e7675c72/attachment.htm 

More information about the Twisted-Python mailing list