Uploaded image for project: 'mod_python'
  1. mod_python
  2. MODPYTHON-251

Protect against calls to deleted req object

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.3.1
    • None
    • core
    • 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

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            jcarver Jason Carver
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: