[mod_python] Re: child process XXXX still did not exit, sending a SIGTERM

Martin Blais blais at furius.ca
Wed Jan 4 00:25:05 EST 2006

On 1/3/06, Martin Blais <blais at furius.ca> wrote:
> My main problem is getting more info at that point, because even if I
> attach a gdb to the cihld process, apache insists on sending it
> SIGKILL 10 seconds later.  I just had an idea on the way to dinner,
> that I could "simulate" finalisation by calling python_finalize from
> the handler by returning a special signal number, just for this
> purpose.

FWIW, I just implemented this easily: I add a hook in python_handler
to call the finalization code and then exit.  Then I bound a resource
in my web app that return the magic code (442).  So what I do is start
apache, fetch some resources which always trigger the problem, then
fetch the special resource, and watch the finalization code be run and
the child exits.

I was hoping for it to hang, so that I could attach a debugger on it
and inspect my Python child to see what the bugger was doing, but
guess what... when called from the handler, the finalization code
always succeeds!  Go figure.  Is this useful information?

Patch below:

--- mod_python.c        2006-01-03 19:17:44.000000000 -0500
+++ mod_python.orig.c   2006-01-03 11:44:56.000000000 -0500
@@ -1122,14 +1122,6 @@
         else {
             result = PyInt_AsLong(resultobject);

-            /* Fake finalization, just to test and attach a debugger to it. */
-            if ( result == 442 ) {
-              Py_XDECREF(resultobject);
-              python_finalize(NULL);
-              exit(0);
-            }
             /* authen handlers need one more thing
              * if authentication failed and this handler is not
              * authoritative, let the others handle it

More information about the Mod_python mailing list