Loading server/log.c +7 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,13 @@ static void piped_log_maintenance(int reason, void *data, ap_wait_t status) switch (reason) { case APR_OC_REASON_DEATH: pl->pid = NULL; ap_unregister_other_child(pl); if (pl->program == NULL) { /* during a restart */ break; } break; case APR_OC_REASON_LOST: pl->pid = NULL; ap_unregister_other_child(pl); Loading server/mpm/dexter/dexter.c +26 −16 Original line number Diff line number Diff line Loading @@ -275,29 +275,35 @@ static void reclaim_child_processes(int terminate) #endif static int wait_or_timeout_counter; static int wait_or_timeout(ap_wait_t *status) static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p) { struct timeval tv; int ret; ap_status_t rv; ap_proc_t *ret = NULL; ++wait_or_timeout_counter; if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { wait_or_timeout_counter = 0; #ifdef APR_HAS_OTHER_CHILD probe_writable_fds(); ap_probe_writable_fds(); #endif } ret = waitpid(-1, status, WNOHANG); if (ret == -1 && errno == EINTR) { return -1; rv = ap_wait_all_procs(&ret, APR_NOWAIT, p); if (ap_canonical_error(rv) == APR_EINTR) { return NULL; } if (rv == APR_CHILD_DONE) { return ret; } if (ret > 0) { #ifdef NEED_WAITPID if ((ret = reap_children(status)) > 0) { return ret; } #endif tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; ap_select(0, NULL, NULL, NULL, &tv); return -1; return NULL; } /* handle all varieties of core dumping signals */ Loading Loading @@ -489,8 +495,10 @@ static void set_signals(void) #endif } static void process_child_status(int pid, ap_wait_t status) static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status) { int pid; ap_get_os_proc(&pid, abs_pid); /* Child died... if it died due to a fatal error, * we should simply bail out. */ Loading Loading @@ -1077,19 +1085,21 @@ static void server_main_loop(int remaining_children_to_start) { int child_slot; ap_wait_t status; int pid; ap_proc_t *pid; int i; while (!restart_pending && !shutdown_pending) { pid = wait_or_timeout(&status); pid = wait_or_timeout(&status, pconf); if (pid >= 0) { if (pid != NULL) { int actual_pid; ap_get_os_proc(&actual_pid, pid); process_child_status(pid, status); /* non-fatal death... note that it's gone in the child table and * clean out the status table. */ child_slot = -1; for (i = 0; i < max_daemons_limit; ++i) { if (child_table[i].pid == pid) { if (child_table[i].pid == actual_pid) { int j; child_slot = i; Loading @@ -1112,7 +1122,7 @@ static void server_main_loop(int remaining_children_to_start) } #ifdef APR_HAS_OTHER_CHILD } else if (reap_other_child(pid, status) == 0) { else if (ap_reap_other_child(pid, status) == 0) { /* handled */ #endif } Loading server/mpm/mpmt_pthread/mpmt_pthread.c +24 −15 Original line number Diff line number Diff line Loading @@ -271,29 +271,35 @@ static void reclaim_child_processes(int terminate) #endif static int wait_or_timeout_counter; static int wait_or_timeout(ap_wait_t *status) static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p) { struct timeval tv; int ret; ap_status_t rv; ap_proc_t *ret = NULL; ++wait_or_timeout_counter; if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { wait_or_timeout_counter = 0; #ifdef APR_HAS_OTHER_CHILD probe_writable_fds(); ap_probe_writable_fds(); #endif } ret = waitpid(-1, status, WNOHANG); if (ret == -1 && errno == EINTR) { return -1; rv = ap_wait_all_procs(&ret, APR_NOWAIT, p); if (ap_canonical_error(rv) == APR_EINTR) { return NULL; } if (rv == APR_CHILD_DONE) { return ret; } if (ret > 0) { #ifdef NEED_WAITPID if ((ret = reap_children(status)) > 0) { return ret; } #endif tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; ap_select(0, NULL, NULL, NULL, &tv); return -1; return NULL; } /* handle all varieties of core dumping signals */ Loading Loading @@ -486,8 +492,10 @@ static void set_signals(void) #endif } static void process_child_status(int pid, ap_wait_t status) static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status) { int pid; ap_get_os_proc(&pid, abs_pid); /* Child died... if it died due to a fatal error, * we should simply bail out. */ Loading Loading @@ -1110,13 +1118,14 @@ static void server_main_loop(int remaining_children_to_start) { int child_slot; ap_wait_t status; int pid; ap_proc_t *pid; int i; while (!restart_pending && !shutdown_pending) { pid = wait_or_timeout(&status); /* this is a memory leak, but I'll fix it later. */ pid = wait_or_timeout(&status, pconf); if (pid >= 0) { if (pid != NULL) { process_child_status(pid, status); /* non-fatal death... note that it's gone in the scoreboard. */ child_slot = find_child_by_pid(pid); Loading @@ -1135,7 +1144,7 @@ static void server_main_loop(int remaining_children_to_start) } #ifdef APR_HAS_OTHER_CHILD } else if (reap_other_child(pid, status) == 0) { else if (ap_reap_other_child(pid, status) == 0) { /* handled */ #endif } Loading server/mpm/mpmt_pthread/scoreboard.c +5 −2 Original line number Diff line number Diff line Loading @@ -201,13 +201,16 @@ void increment_counts(int child_num, int thread_num, request_rec *r) } API_EXPORT(int) find_child_by_pid(int pid) API_EXPORT(int) find_child_by_pid(ap_proc_t *pid) { int i; int actual_pid; int max_daemons_limit = ap_get_max_daemons(); ap_get_os_proc(&actual_pid, pid); for (i = 0; i < max_daemons_limit; ++i) if (ap_scoreboard_image->parent[i].pid == pid) if (ap_scoreboard_image->parent[i].pid == actual_pid) return i; return -1; Loading server/mpm/mpmt_pthread/scoreboard.h +1 −1 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ API_EXPORT(void) reopen_scoreboard(ap_pool_t *p); ap_inline void ap_sync_scoreboard_image(void); void increment_counts(int child_num, int thread_num, request_rec *r); void update_scoreboard_global(void); API_EXPORT(int) find_child_by_pid(int pid); API_EXPORT(int) find_child_by_pid(ap_proc_t *pid); int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r); void ap_time_process_request(int child_num, int thread_num, int status); Loading Loading
server/log.c +7 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,13 @@ static void piped_log_maintenance(int reason, void *data, ap_wait_t status) switch (reason) { case APR_OC_REASON_DEATH: pl->pid = NULL; ap_unregister_other_child(pl); if (pl->program == NULL) { /* during a restart */ break; } break; case APR_OC_REASON_LOST: pl->pid = NULL; ap_unregister_other_child(pl); Loading
server/mpm/dexter/dexter.c +26 −16 Original line number Diff line number Diff line Loading @@ -275,29 +275,35 @@ static void reclaim_child_processes(int terminate) #endif static int wait_or_timeout_counter; static int wait_or_timeout(ap_wait_t *status) static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p) { struct timeval tv; int ret; ap_status_t rv; ap_proc_t *ret = NULL; ++wait_or_timeout_counter; if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { wait_or_timeout_counter = 0; #ifdef APR_HAS_OTHER_CHILD probe_writable_fds(); ap_probe_writable_fds(); #endif } ret = waitpid(-1, status, WNOHANG); if (ret == -1 && errno == EINTR) { return -1; rv = ap_wait_all_procs(&ret, APR_NOWAIT, p); if (ap_canonical_error(rv) == APR_EINTR) { return NULL; } if (rv == APR_CHILD_DONE) { return ret; } if (ret > 0) { #ifdef NEED_WAITPID if ((ret = reap_children(status)) > 0) { return ret; } #endif tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; ap_select(0, NULL, NULL, NULL, &tv); return -1; return NULL; } /* handle all varieties of core dumping signals */ Loading Loading @@ -489,8 +495,10 @@ static void set_signals(void) #endif } static void process_child_status(int pid, ap_wait_t status) static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status) { int pid; ap_get_os_proc(&pid, abs_pid); /* Child died... if it died due to a fatal error, * we should simply bail out. */ Loading Loading @@ -1077,19 +1085,21 @@ static void server_main_loop(int remaining_children_to_start) { int child_slot; ap_wait_t status; int pid; ap_proc_t *pid; int i; while (!restart_pending && !shutdown_pending) { pid = wait_or_timeout(&status); pid = wait_or_timeout(&status, pconf); if (pid >= 0) { if (pid != NULL) { int actual_pid; ap_get_os_proc(&actual_pid, pid); process_child_status(pid, status); /* non-fatal death... note that it's gone in the child table and * clean out the status table. */ child_slot = -1; for (i = 0; i < max_daemons_limit; ++i) { if (child_table[i].pid == pid) { if (child_table[i].pid == actual_pid) { int j; child_slot = i; Loading @@ -1112,7 +1122,7 @@ static void server_main_loop(int remaining_children_to_start) } #ifdef APR_HAS_OTHER_CHILD } else if (reap_other_child(pid, status) == 0) { else if (ap_reap_other_child(pid, status) == 0) { /* handled */ #endif } Loading
server/mpm/mpmt_pthread/mpmt_pthread.c +24 −15 Original line number Diff line number Diff line Loading @@ -271,29 +271,35 @@ static void reclaim_child_processes(int terminate) #endif static int wait_or_timeout_counter; static int wait_or_timeout(ap_wait_t *status) static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p) { struct timeval tv; int ret; ap_status_t rv; ap_proc_t *ret = NULL; ++wait_or_timeout_counter; if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { wait_or_timeout_counter = 0; #ifdef APR_HAS_OTHER_CHILD probe_writable_fds(); ap_probe_writable_fds(); #endif } ret = waitpid(-1, status, WNOHANG); if (ret == -1 && errno == EINTR) { return -1; rv = ap_wait_all_procs(&ret, APR_NOWAIT, p); if (ap_canonical_error(rv) == APR_EINTR) { return NULL; } if (rv == APR_CHILD_DONE) { return ret; } if (ret > 0) { #ifdef NEED_WAITPID if ((ret = reap_children(status)) > 0) { return ret; } #endif tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; ap_select(0, NULL, NULL, NULL, &tv); return -1; return NULL; } /* handle all varieties of core dumping signals */ Loading Loading @@ -486,8 +492,10 @@ static void set_signals(void) #endif } static void process_child_status(int pid, ap_wait_t status) static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status) { int pid; ap_get_os_proc(&pid, abs_pid); /* Child died... if it died due to a fatal error, * we should simply bail out. */ Loading Loading @@ -1110,13 +1118,14 @@ static void server_main_loop(int remaining_children_to_start) { int child_slot; ap_wait_t status; int pid; ap_proc_t *pid; int i; while (!restart_pending && !shutdown_pending) { pid = wait_or_timeout(&status); /* this is a memory leak, but I'll fix it later. */ pid = wait_or_timeout(&status, pconf); if (pid >= 0) { if (pid != NULL) { process_child_status(pid, status); /* non-fatal death... note that it's gone in the scoreboard. */ child_slot = find_child_by_pid(pid); Loading @@ -1135,7 +1144,7 @@ static void server_main_loop(int remaining_children_to_start) } #ifdef APR_HAS_OTHER_CHILD } else if (reap_other_child(pid, status) == 0) { else if (ap_reap_other_child(pid, status) == 0) { /* handled */ #endif } Loading
server/mpm/mpmt_pthread/scoreboard.c +5 −2 Original line number Diff line number Diff line Loading @@ -201,13 +201,16 @@ void increment_counts(int child_num, int thread_num, request_rec *r) } API_EXPORT(int) find_child_by_pid(int pid) API_EXPORT(int) find_child_by_pid(ap_proc_t *pid) { int i; int actual_pid; int max_daemons_limit = ap_get_max_daemons(); ap_get_os_proc(&actual_pid, pid); for (i = 0; i < max_daemons_limit; ++i) if (ap_scoreboard_image->parent[i].pid == pid) if (ap_scoreboard_image->parent[i].pid == actual_pid) return i; return -1; Loading
server/mpm/mpmt_pthread/scoreboard.h +1 −1 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ API_EXPORT(void) reopen_scoreboard(ap_pool_t *p); ap_inline void ap_sync_scoreboard_image(void); void increment_counts(int child_num, int thread_num, request_rec *r); void update_scoreboard_global(void); API_EXPORT(int) find_child_by_pid(int pid); API_EXPORT(int) find_child_by_pid(ap_proc_t *pid); int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r); void ap_time_process_request(int child_num, int thread_num, int status); Loading