From 3b7cc4481cf69328c8648a05b2b8cada9b9e8b39 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Fri, 25 Feb 2022 13:18:51 +0000 Subject: *) mod_watchdog: add assertions to cleanup code *) core/mpm_preform: do not invoke the fancy new child_stopping/stopped hooks when invoked from a signal handler. This is a stopgap to some strange behaviour in need of some deeper insight. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898418 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/prefork/prefork.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'server') diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 71532d611c..e26ee4f7ef 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -218,8 +218,8 @@ static void prefork_note_child_started(int slot, pid_t pid) } /* a clean exit from a child with proper cleanup */ -static void clean_child_exit(int code) __attribute__ ((noreturn)); -static void clean_child_exit(int code) +static void clean_child_exit_ex(int code, int from_signal) __attribute__ ((noreturn)); +static void clean_child_exit_ex(int code, int from_signal) { apr_signal(SIGHUP, SIG_IGN); apr_signal(SIGTERM, SIG_IGN); @@ -227,9 +227,9 @@ static void clean_child_exit(int code) retained->mpm->mpm_state = AP_MPMQ_STOPPING; if (pchild) { - if (code == 0) { - ap_run_child_stopping(pchild, 0); - ap_run_child_stopped(pchild, 0); + if (!code && !from_signal) { + ap_run_child_stopping(pchild, !retained->mpm->is_ungraceful); + ap_run_child_stopped(pchild, !retained->mpm->is_ungraceful); } apr_pool_destroy(pchild); /* @@ -248,6 +248,13 @@ static void clean_child_exit(int code) exit(code); } +/* a clean exit from a child with proper cleanup */ +static void clean_child_exit(int code) __attribute__ ((noreturn)); +static void clean_child_exit(int code) +{ + clean_child_exit_ex(code, 0); +} + static apr_status_t accept_mutex_on(void) { apr_status_t rv = apr_proc_mutex_lock(my_bucket->mutex); @@ -364,7 +371,7 @@ static const char *prefork_get_name(void) static void just_die(int sig) { - clean_child_exit(0); + clean_child_exit_ex(0, 1); } /* volatile because it's updated from a signal handler */ -- cgit v1.2.3