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

Protect against calls to deleted req object

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.1
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • 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

      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

            • Assignee:
              Unassigned
              Reporter:
              jcarver Jason Carver
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: