<p dir="ltr">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.</p>
<p dir="ltr">Justin Venus</p>
<div class="gmail_quote">On Jul 24, 2012 10:21 PM, "Tom Sheffler" <<a href="mailto:tom.sheffler@gmail.com">tom.sheffler@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hi Twisted Folks,</div><div><br></div><div>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:</div><div><br>
</div>
<div> /bin/bash -c 'kill -s SIGTERM `cat /var/run/sensrtunw/sensrtunw.pid`'</div><div><br></div><div>Occasionally, this is unsuccessful in killing the twistd process, and I need to use a SIGKILL manually as a last resort.</div>
<div><br></div><div>Any ideas why?</div><div><br></div><div>I believe the SIGTERM method will do a clean shutdown, calling the appropriate stopService methods. This would be the preferred method.</div><div><br></div><div>
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?</div>
<div><br></div><div>Suggestions or comments appreciated.</div><div>-Tom</div><div><br></div><div><br></div><div><br></div>
<br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div>