diff options
author | Jeff Trawick <trawick@apache.org> | 2004-12-02 18:39:22 +0100 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2004-12-02 18:39:22 +0100 |
commit | 592750b026b9a5d3a7f401796ec1763ca2b79984 (patch) | |
tree | 0b4ec1409ce8ef98e8b4750ecfe8dc30434d1364 /include | |
parent | wrong format string was converted to APR_PID_T_FMT (diff) | |
download | apache2-592750b026b9a5d3a7f401796ec1763ca2b79984.tar.xz apache2-592750b026b9a5d3a7f401796ec1763ca2b79984.zip |
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 'include')
-rw-r--r-- | include/mpm_common.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/include/mpm_common.h b/include/mpm_common.h index 85a4db5606..e10f840c3d 100644 --- a/include/mpm_common.h +++ b/include/mpm_common.h @@ -59,7 +59,7 @@ extern "C" { * Make sure all child processes that have been spawned by the parent process * have died. This includes process registered as "other_children". * @warning This is only defined if the MPM defines - * MPM_NEEDS_RECLAIM_CHILD_PROCESS + * AP_MPM_WANT_RECLAIM_CHILD_PROCESSES * @param terminate Either 1 or 0. If 1, send the child processes SIGTERM * each time through the loop. If 0, give the process time to die * on its own before signalling it. @@ -67,12 +67,43 @@ extern "C" { * MPM_CHILD_PID -- Get the pid from the specified spot in the scoreboard * MPM_NOTE_CHILD_KILLED -- Note the child died in the scoreboard * </pre> + * @tip The MPM child processes which are reclaimed are those listed + * in the scoreboard as well as those currently registered via + * ap_register_extra_mpm_process(). */ #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES void ap_reclaim_child_processes(int terminate); #endif /** + * Tell ap_reclaim_child_processes() about an MPM child process which has no + * entry in the scoreboard. + * @warning This is only defined if the MPM defines + * AP_MPM_WANT_RECLAIM_CHILD_PROCESSES + * @param pid The process id of an MPM child process which should be + * reclaimed when ap_reclaim_child_processes() is called. + * @tip If an extra MPM child process terminates prior to calling + * ap_reclaim_child_processes(), remove it from the list of such processes + * by calling ap_unregister_extra_mpm_process(). + */ +#ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES +void ap_register_extra_mpm_process(pid_t pid); +#endif + +/** + * Unregister an MPM child process which was previously registered by a + * call to ap_register_extra_mpm_process(). + * @warning This is only defined if the MPM defines + * AP_MPM_WANT_RECLAIM_CHILD_PROCESSES + * @param pid The process id of an MPM child process which no longer needs to + * be reclaimed. + * @return 1 if the process was found and removed, 0 otherwise + */ +#ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES +int ap_unregister_extra_mpm_process(pid_t pid); +#endif + +/** * Determine if any child process has died. If no child process died, then * this process sleeps for the amount of time specified by the MPM defined * macro SCOREBOARD_MAINTENANCE_INTERVAL. |