diff options
| author | Jeff Trawick <trawick@apache.org> | 2004-12-02 17:39:22 +0000 |
|---|---|---|
| committer | Jeff Trawick <trawick@apache.org> | 2004-12-02 17:39:22 +0000 |
| commit | 592750b026b9a5d3a7f401796ec1763ca2b79984 (patch) | |
| tree | 0b4ec1409ce8ef98e8b4750ecfe8dc30434d1364 /server/mpm | |
| parent | 7eb243ba752c6217fd6815a25cf0279f749815c8 (diff) | |
| download | httpd-592750b026b9a5d3a7f401796ec1763ca2b79984.tar.gz | |
worker MPM: Fix a problem which could cause httpd processes to
remain active after shutdown.
The problem occurred when a scoreboard entry currently
in use by an exiting child process was used for a new child
process. At that point, the MPM forgot about the exiting
child process, so ap_reclaim_child_processes() wouldn't be
able to forceably terminate it.
(An exiting child process may *never* exit due to a stuck
or long-running request being handled on one of the threads.)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@109510 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/mpm')
| -rw-r--r-- | server/mpm/worker/worker.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index b13facdd33..764036b834 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -1310,6 +1310,21 @@ static int make_child(server_rec *s, int slot) clean_child_exit(0); } /* else */ + if (ap_scoreboard_image->parent[slot].pid != 0) { + /* This new child process is squatting on the scoreboard + * entry owned by an exiting child process, which cannot + * exit until all active requests complete. + * Don't forget about this exiting child process, or we + * won't be able to kill it if it doesn't exit by the + * time the server is shut down. + */ + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, + "taking over scoreboard slot from %" APR_PID_T_FMT "%s", + ap_scoreboard_image->parent[slot].pid, + ap_scoreboard_image->parent[slot].quiescing ? + " (quiescing)" : ""); + ap_register_extra_mpm_process(ap_scoreboard_image->parent[slot].pid); + } ap_scoreboard_image->parent[slot].quiescing = 0; ap_scoreboard_image->parent[slot].pid = pid; return 0; @@ -1524,6 +1539,9 @@ static void server_main_loop(int remaining_children_to_start) make_child(ap_server_conf, child_slot); --remaining_children_to_start; } + } + else if (ap_unregister_extra_mpm_process(pid.pid) == 1) { + /* handled */ #if APR_HAS_OTHER_CHILD } else if (apr_proc_other_child_alert(&pid, APR_OC_REASON_DEATH, |
