You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Jason Carver (JIRA)" <ji...@apache.org> on 2008/08/07 01:56:44 UTC

[jira] Created: (MODPYTHON-251) Protect against calls to deleted req object

Protect against calls to deleted req object
-------------------------------------------

                 Key: MODPYTHON-251
                 URL: https://issues.apache.org/jira/browse/MODPYTHON-251
             Project: mod_python
          Issue Type: Improvement
          Components: core
    Affects Versions: 3.3.1
         Environment: Replicated on:
Windows XP SP3, using Apache 2.2, Python 2.5.2
Ubuntu 7.10, using Apache 2.2, Python 2.5.2
            Reporter: Jason Carver


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.