[Zope-dev] zc.async versus Zope 2 SIGTERM

0 views
Skip to first unread message

Christian Theune

unread,
Mar 1, 2012, 6:19:46 AM3/1/12
to zope...@zope.org
Hi,

zc.async's shutdown mechanism doesn't really work with Zope 2's SIGTERM
handling: in my case it causes the Async's threaded dispatcher to die in
the middle of something:

Exception in thread Thread-1 (most likely raised during interpreter
shutdown):
Traceback (most recent call last):
File "/home/ctheune/local/lib/python2.6/threading.py", line 532, in
__bootstrap_inner
File "/home/ctheune/local/lib/python2.6/threading.py", line 484, in run
File
"/home/ctheune/gocept/code/...deployment/eggs/zc.async-1.5.4-py2.6.egg/zc/async/subscribers.py",
line 115, in start
File
"/home/ctheune/gocept/code/...deployment/eggs/Twisted-10.2.0-py2.6-linux-x86_64.egg/twisted/internet/base.py",
line 1158, in run
File
"/home/ctheune/gocept/code/...deployment/eggs/Twisted-10.2.0-py2.6-linux-x86_64.egg/twisted/internet/base.py",
line 1172, in mainLoop
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'msg'

This ends up in the worker not correctly unregistered and thus on next
startup:

Exception in thread Thread-1 (most likely raised during interpreter
shutdown):
Traceback (most recent call last):
File "/home/ctheune/local/lib/python2.6/threading.py", line 532, in
__bootstrap_inner
File "/home/ctheune/local/lib/python2.6/threading.py", line 484, in run
File
"/home/ctheune/gocept/code/webwork.deployment/eggs/zc.async-1.5.4-py2.6.egg/zc/async/subscribers.py",
line 115, in start
File
"/home/ctheune/gocept/code/webwork.deployment/eggs/Twisted-10.2.0-py2.6-linux-x86_64.egg/twisted/internet/base.py",
line 1158, in run
File
"/home/ctheune/gocept/code/webwork.deployment/eggs/Twisted-10.2.0-py2.6-linux-x86_64.egg/twisted/internet/base.py",
line 1172, in mainLoop
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'msg'

The funny thing is: although this instance didn't get to register it
will then on regular shutdown:

2012-03-01 11:54:56 INFO zc.async.events deactivated dispatcher
8da98af0-5c95-11e1-a205-0024e8d50597
2012-03-01 11:54:56 INFO SignalHandler Caught signal SIGINT
2012-03-01 11:54:56 INFO Z2 Shutting down

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.)

The second issue seems like a bad thing. Right?

Any comments?
Christian

--
Christian Theune · c...@gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1
Zope and Plone consulting, development, hosting, operations

_______________________________________________
Zope-Dev maillist - Zope...@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )

Vincent Fretin

unread,
Mar 1, 2012, 7:42:27 AM3/1/12
to Christian Theune, zope...@zope.org
Hi,

Did you look how http://pypi.python.org/pypi/plone.app.async have done the integration with Zope2?

Vincent Fretin
Ecreall
Site : http://vincentfretin.ecreall.com

Hanno Schlichting

unread,
Mar 1, 2012, 8:13:40 AM3/1/12
to Vincent Fretin, Christian Theune, zope...@zope.org
On Thu, Mar 1, 2012 at 1:42 PM, Vincent Fretin <vincent...@gmail.com> wrote:
> Did you look how http://pypi.python.org/pypi/plone.app.async have done the
> integration with Zope2?

IIRC we (Jarn) ran into the same problem when running p.a.async. Our
"solution" was to switch to using SIGINT for process shutdown. We used
supervisor, so for each Zope process section we added stopsignal=INT

But on unexpected process or server restarts, we still had stuck
workers once in a while. We never had the time to investigate, so just
handled those manually.

Hanno

Reply all
Reply to author
Forward
0 new messages