Bug#418067: apache2-mpm-prefork: apache2 -X kills wrong process group on exit
In apache2.2 (at least prefork mpm), 'apache2 -X' doesn't create a new
process group. Despite that, on exit it sends a SIGTERM to whatever
the process group is, causing all sorts of damage. Amongst them a
FTBFS on libembperl-perl when building/testing against apache 2.2 (bug
The broken code is in server/mpm/prefork/prefork.c. Follow the
behaviour of one_process=1 (triggered by -X): In prefork_pre_config()
it carefully avoids calling apr_proc_detach(), which would have done
all the daemonising, including creating a new process group. In
ap_mpm_run() it calls unixd_killpg(getpgrp(), SIGTERM) during both
graceful and ungraceful shutdown.
I haven't looked at other mpm's code to see if the bug exists in some
form there too.
libembperl-perl ran its apache2 tests happily with apache2.0 so I
presume this is a relatively new bug.
I /think/ calling apr_proc_detach(APR_PROC_DETACH_FOREGROUND) even in
one_process (and probably all other foreground/no_detach) cases is the
right thing to do but I haven't tried it at all.
Versions of packages apache2-mpm-prefork depends on:
ii apache2. 2.2.3-4 Next generation, scalable, extenda
ii libapr1 1.2.7-8.2 The Apache Portable Runtime Librar
ii libaprut 1.2.7+dfsg-2 The Apache Portable Runtime Utilit
ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries
ii libdb4.4 4.4.20-8 Berkeley v4.4 Database Libraries [
ii libexpat 1.95.8-3.4 XML parsing C library - runtime li
ii libldap2 2.1.30-13.3 OpenLDAP libraries
ii libpcre3 6.7-1 Perl 5 Compatible Regular Expressi
ii libpq4 8.1.8-1 PostgreSQL C client library
ii libsqlit 3.3.8-1.1 SQLite 3 shared library
ii libuuid1 1.39+1.40-WIP-2006.11.14+dfsg-2 universally unique id library