Issue Details (XML | Word | Printable)

Key: MODPYTHON-90
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Graham Dumpleton
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

Explicitly don't allow Pdb support to work if not ONE_PROCESS mode.

Created: 11/Nov/05 02:35 PM   Updated: 02/Apr/07 11:37 AM
Return to search
Component/s: core
Affects Version/s: 3.3.x
Fix Version/s: 3.3.1

Time Tracking:
Not Specified

Resolution Date: 24/Apr/06 12:56 PM


 Description  « Hide
mod_python provides the PythonEnablePdb option for enabling of the Python debugger. For it to work properly though, it is necessary to start httpd from the command line with the -DONE_PROCESS option. If one doesn't do this though and enables PythonEnablePdb when Apache is running normally, any request to a URL for which the debugger is enabled will yield a 500 error. The details of the 500 error will be:

  Mod_python error: "PythonHandler mptest"

  Traceback (most recent call last):

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
      assert (type(result) == type(int())), \

  AssertionError: Handler 'mptest' returned invalid return code.

This error message isn't particularly helpful in understanding that the problem is that the debugger can't be run in this mode.

To avoid this problem at the moment, all that can be done is for the user to know that their Apache configuration should actually say:

  <IfDefine ONE_PROCESS>
  PythonEnablePdb On
  </IfDefine>

This would mean they could leave the Apache configuration set the one way and not have to worry.

What could instead be done in mod_python though is simply to ignore the PythonEnablePdb option and that it is set if Apache hasn't been run in ONE_PROCESS mode. Thus, presuming that MODPYTHON-89 has been implemented, the mod_python code in mod_python.apache in the number of places where it occurs, could say:

                # call the object
                if exists_config_define("ONE_PROCESS") and config.has_key("PythonEnablePdb"):
                    result = pdb.runcall(object, conn)
                else:
                    result = object(conn)



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Graham Dumpleton added a comment - 10/Mar/06 01:40 PM
Linked issues which will be addressed by rewritten module importer and top level handler dispatcher.

Graham Dumpleton made changes - 10/Mar/06 01:40 PM
Field Original Value New Value
Link This issue depends upon MODPYTHON-143 [ MODPYTHON-143 ]
Graham Dumpleton made changes - 01/Apr/06 01:37 PM
Assignee Graham Dumpleton [ grahamd ]
Graham Dumpleton made changes - 01/Apr/06 01:57 PM
Status Open [ 1 ] In Progress [ 3 ]
Repository Revision Date User Message
ASF #396440 Mon Apr 24 05:41:45 UTC 2006 grahamd The PythonEnablePdb configuration option will now be ignored if Apache
hasn't been started up in single process mode. (MODPYTHON-90)

If running Apache in single process mode with PDB enabled and the "quit"
command is used to exit that debug session, an exception indicating that
the PDB session has been aborted is raised rather than None being returned
with a subsequent error complaining about the handler returning an invalid
value. (MODPYTHON-91)

Both these changes were back ported from new importer code to the old
importer code.
Files Changed
MODIFY /httpd/mod_python/trunk/Doc/appendixc.tex
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/apache.py

Graham Dumpleton made changes - 24/Apr/06 12:54 PM
Link This issue depends upon MODPYTHON-143 [ MODPYTHON-143 ]
Graham Dumpleton made changes - 24/Apr/06 12:56 PM
Fix Version/s 3.3 [ 12310101 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Graham Dumpleton added a comment - 02/Apr/07 11:37 AM
This issue may have to be revisited as using -X option has same effect as running -DONE_PROCESS -DNO_DETACH and would also allow debugging, but no ONE_PROCESS option is set that can be checked for. You might even be able to use -DDEBUG as well. Thus, at the moment, one has to redundantly add -DONE_PROCESS to the -X option for this code change to work. No one has complained yet though which suggests no one really uses it.

Graham Dumpleton made changes - 02/Apr/07 11:37 AM
Status Resolved [ 5 ] Closed [ 6 ]