Hi,<br><br>Did you look how <a href="http://pypi.python.org/pypi/plone.app.async">http://pypi.python.org/pypi/plone.app.async</a> have done the integration with Zope2?<br><br clear="all">Vincent Fretin<br>Ecreall<br>Site : <a href="http://vincentfretin.ecreall.com">http://vincentfretin.ecreall.com</a><br>


<br><br><div class="gmail_quote">On Thu, Mar 1, 2012 at 12:19 PM, Christian Theune <span dir="ltr">&lt;<a href="mailto:ct@gocept.com">ct@gocept.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi,<br>
<br>
zc.async&#39;s shutdown mechanism doesn&#39;t really work with Zope 2&#39;s SIGTERM handling: in my case it causes the Async&#39;s threaded dispatcher to die in the middle of something:<br>
<br>
Exception in thread Thread-1 (most likely raised during interpreter shutdown):<br>
Traceback (most recent call last):<br>
  File &quot;/home/ctheune/local/lib/<u></u>python2.6/threading.py&quot;, line 532, in __bootstrap_inner<br>
  File &quot;/home/ctheune/local/lib/<u></u>python2.6/threading.py&quot;, line 484, in run<br>
  File &quot;/home/ctheune/gocept/code/...<u></u>deployment/eggs/zc.async-1.5.<u></u>4-py2.6.egg/zc/async/<u></u>subscribers.py&quot;, line 115, in start<br>
  File &quot;/home/ctheune/gocept/code/...<u></u>deployment/eggs/Twisted-10.2.<u></u>0-py2.6-linux-x86_64.egg/<u></u>twisted/internet/base.py&quot;, line 1158, in run<br>
  File &quot;/home/ctheune/gocept/code/...<u></u>deployment/eggs/Twisted-10.2.<u></u>0-py2.6-linux-x86_64.egg/<u></u>twisted/internet/base.py&quot;, line 1172, in mainLoop<br>
&lt;type &#39;exceptions.AttributeError&#39;&gt;: &#39;NoneType&#39; object has no attribute &#39;msg&#39;<br>
<br>
This ends up in the worker not correctly unregistered and thus on next startup:<br>
<br>
Exception in thread Thread-1 (most likely raised during interpreter shutdown):<br>
Traceback (most recent call last):<br>
  File &quot;/home/ctheune/local/lib/<u></u>python2.6/threading.py&quot;, line 532, in __bootstrap_inner<br>
  File &quot;/home/ctheune/local/lib/<u></u>python2.6/threading.py&quot;, line 484, in run<br>
  File &quot;/home/ctheune/gocept/code/<u></u>webwork.deployment/eggs/zc.<u></u>async-1.5.4-py2.6.egg/zc/<u></u>async/subscribers.py&quot;, line 115, in start<br>
  File &quot;/home/ctheune/gocept/code/<u></u>webwork.deployment/eggs/<u></u>Twisted-10.2.0-py2.6-linux-<u></u>x86_64.egg/twisted/internet/<u></u>base.py&quot;, line 1158, in run<br>
  File &quot;/home/ctheune/gocept/code/<u></u>webwork.deployment/eggs/<u></u>Twisted-10.2.0-py2.6-linux-<u></u>x86_64.egg/twisted/internet/<u></u>base.py&quot;, line 1172, in mainLoop<br>
&lt;type &#39;exceptions.AttributeError&#39;&gt;: &#39;NoneType&#39; object has no attribute &#39;msg&#39;<br>
<br>
The funny thing is: although this instance didn&#39;t get to register it will then on regular shutdown:<br>
<br>
2012-03-01 11:54:56 INFO zc.async.events deactivated dispatcher<br>
8da98af0-5c95-11e1-a205-<u></u>0024e8d50597<br>
2012-03-01 11:54:56 INFO SignalHandler Caught signal SIGINT<br>
2012-03-01 11:54:56 INFO Z2 Shutting down<br>
<br>
The first issue (fast shutdown) you can avoid by simply not sending SIGTERM and switching to always use SIGINT. (For some reason zdaemon seems to do that by default when sending SIGTERM to the daemon manager.)<br>
<br>
The second issue seems like a bad thing. Right?<br>
<br>
Any comments?<br>
Christian<br>
<br>
<br>
<br>
-- <br>
Christian Theune · <a href="mailto:ct@gocept.com" target="_blank">ct@gocept.com</a><br>
gocept gmbh &amp; co. kg · forsterstraße 29 · 06112 halle (saale) · germany<br>
<a href="http://gocept.com" target="_blank">http://gocept.com</a> · tel <a href="tel:%2B49%20345%201229889%200" value="+4934512298890" target="_blank">+49 345 1229889 0</a> · fax <a href="tel:%2B49%20345%201229889%201" value="+4934512298891" target="_blank">+49 345 1229889 1</a><br>


Zope and Plone consulting, development, hosting, operations<br>
<br>
______________________________<u></u>_________________<br>
Zope-Dev maillist  -  <a href="mailto:Zope-Dev@zope.org" target="_blank">Zope-Dev@zope.org</a><br>
<a href="https://mail.zope.org/mailman/listinfo/zope-dev" target="_blank">https://mail.zope.org/mailman/<u></u>listinfo/zope-dev</a><br>
**  No cross posts or HTML encoding!  **<br>
(Related lists -<br>
<a href="https://mail.zope.org/mailman/listinfo/zope-announce" target="_blank">https://mail.zope.org/mailman/<u></u>listinfo/zope-announce</a><br>
<a href="https://mail.zope.org/mailman/listinfo/zope" target="_blank">https://mail.zope.org/mailman/<u></u>listinfo/zope</a> )<br>
</blockquote></div><br>