Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.3.1
-
None
-
None
-
Replicated on:
Windows XP SP3, using Apache 2.2, Python 2.5.2
Ubuntu 7.10, using Apache 2.2, Python 2.5.2
Description
When the logging module is passed the Apache req object as a handler, and the req object is never removed, subsequent calls to logging crash mod_python and Apache. I expected the page to display a Traceback instead.
This code demonstrates the crash:
def testCrash(req):
"""
Reliably crash server (on 2nd page access)
Open as: http://server/index.py/testCrash
"""
handler = logging.StreamHandler(req)
logging.getLogger('').addHandler( handler )
logging.exception('I crash')
#removing this line will cause an apache crash on the
- second web page access
logging.getLogger('').removeHandler(handler)
This code clearly has a bug if that last line is indeed commented out (causing Apache to crash), but crashing is an unhelpful way of notifying the user of that.