[Zope-Checkins] SVN: Zope/branches/2.10/ Prevent uncaught exceptions from killing ZServer worker threads.
Tres Seaver
tseaver at palladion.com
Wed Sep 1 09:31:48 EDT 2010
Log message for revision 116087:
Prevent uncaught exceptions from killing ZServer worker threads.
See https://bugs.launchpad.net/zope2/+bug/627988.
Changed:
U Zope/branches/2.10/doc/CHANGES.txt
U Zope/branches/2.10/lib/python/ZServer/PubCore/ZServerPublisher.py
-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt 2010-09-01 12:17:04 UTC (rev 116086)
+++ Zope/branches/2.10/doc/CHANGES.txt 2010-09-01 13:31:48 UTC (rev 116087)
@@ -8,6 +8,9 @@
Bugs fixed
+ - Prevent uncaught exceptions from killing ZServer worker threads.
+ https://bugs.launchpad.net/zope2/+bug/627988
+
- Updated 'pytz' external to point to '2010b' version (not via Zope3).
- Protect ZCTextIndex's clear method against storing Acquisition wrappers.
Modified: Zope/branches/2.10/lib/python/ZServer/PubCore/ZServerPublisher.py
===================================================================
--- Zope/branches/2.10/lib/python/ZServer/PubCore/ZServerPublisher.py 2010-09-01 12:17:04 UTC (rev 116086)
+++ Zope/branches/2.10/lib/python/ZServer/PubCore/ZServerPublisher.py 2010-09-01 13:31:48 UTC (rev 116087)
@@ -11,28 +11,36 @@
#
##############################################################################
+import logging
+
+LOG = logging.getLogger('ZServerPublisher')
+
class ZServerPublisher:
def __init__(self, accept):
+ from sys import exc_info
from ZPublisher import publish_module
from ZPublisher.WSGIPublisher import publish_module as publish_wsgi
while 1:
- name, a, b=accept()
- if name == "Zope2":
- try:
- publish_module(
- name,
- request=a,
- response=b)
- finally:
- b._finish()
- a=b=None
+ try:
+ name, a, b=accept()
+ if name == "Zope2":
+ try:
+ publish_module(
+ name,
+ request=a,
+ response=b)
+ finally:
+ b._finish()
+ a=b=None
- elif name == "Zope2WSGI":
- try:
- res = publish_wsgi(a, b)
- for r in res:
- a['wsgi.output'].write(r)
- finally:
- # TODO: Support keeping connections open.
- a['wsgi.output']._close = 1
- a['wsgi.output'].close()
+ elif name == "Zope2WSGI":
+ try:
+ res = publish_wsgi(a, b)
+ for r in res:
+ a['wsgi.output'].write(r)
+ finally:
+ # TODO: Support keeping connections open.
+ a['wsgi.output']._close = 1
+ a['wsgi.output'].close()
+ except:
+ LOG.error('exception caught', exc_info=True)
More information about the Zope-Checkins
mailing list