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

Christian Theune ct at gocept.com
Thu Mar 1 11:19:46 UTC 2012


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 · ct at 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



More information about the Zope-Dev mailing list