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

Martin Blais blais at furius.ca
Wed Jan 4 01:17:03 EST 2006


On 1/4/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> Martin Blais wrote ..
> > Anyway, in any case, it hangs in my own custom interpreter, and not in
> > the main_interpreter.
> >
> > 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.
>
> Which is why I suggested using "apachectl graceful" as if I read the
> documentation correctly, the main Apache process will wait for the child
> to exit properly. By default if ShutdownGracefulTimeout is not set or 0,
> it will wait indefinitely and thus wouldn't kill it. This would allow
> you time to attach gdb.
>
> This is of course assuming that that is how it does in fact work. :-)

I know, but this is only available in apache 2.2.

I think I got my hands on something here, here is what I got from a
gdb backtrace when I quickly attach before the child is killed:

#0  0xb7bec054 in __pthread_sigsuspend () from /lib/libpthread.so.0
#1  0xb7bebe98 in __pthread_wait_for_restart_signal () from /lib/libpthread.so.0
#2  0xb7becd6b in [email protected]@GLIBC_2.1 () from /lib/libpthread.so.0
#3  0xb7a2a54f in PyThread_acquire_lock () from
/usr/lib/apache2/modules/mod_python.so
#4  0xb7a2373e in PyThreadState_Delete () from
/usr/lib/apache2/modules/mod_python.so
#5  0xb7a232f8 in PyInterpreterState_Delete () from
/usr/lib/apache2/modules/mod_python.so
#6  0xb7a24663 in Py_EndInterpreter () from
/usr/lib/apache2/modules/mod_python.so
#7  0xb799ff08 in python_finalize () from /usr/lib/apache2/modules/mod_python.so
#8  0xb7ccb6ed in apr_pool_cleanup_run () from /usr/lib/libapr-0.so.0
#9  0xb7ccaf8d in apr_pool_destroy () from /usr/lib/libapr-0.so.0
#10 0x0806860c in ap_graceful_stop_signalled ()
#11 0xb7beeef5 in __pthread_sighandler () from /lib/libpthread.so.0
#12 <signal handler called>
#13 0xb7b750b8 in poll () from /lib/libc.so.6
#14 0xb7ccc2af in apr_poll () from /usr/lib/libapr-0.so.0
#15 0xb7ccca53 in apr_wait_for_io_or_timeout () from /usr/lib/libapr-0.so.0
#16 0xb7cc1f74 in apr_socket_recv () from /usr/lib/libapr-0.so.0
#17 0xb7dd9335 in apr_bucket_socket_create () from /usr/lib/libaprutil-0.so.0
#18 0xb7dd9bce in apr_brigade_split_line () from /usr/lib/libaprutil-0.so.0
#19 0x0807fdfb in ap_get_request_note ()
#20 0x080767a6 in ap_get_brigade ()
#21 0xb7f3db96 in ?? () from /usr/lib/apache2/modules/mod_logio.so
#22 0x08250d80 in ?? ()
#23 0x08272020 in ?? ()
#24 0x00000001 in ?? ()
#25 0x00000000 in ?? ()

Apache terminates its children by sending them a signal in the first
place (#12).   Then, in the Python HEAD_LOCK
(Python-2.4.2/Python/pystate.c), I inspected the code and I can't find
a deadlock problem.  But the pthread semaphore seem to use a signal
itself (the name of the call in frame #0), and we're already in a
signal handler, isn't this prohibited?

Can't remember just now.  (more tomorrow.)

good night,



More information about the Mod_python mailing list