I believe that this chunk of code from server_main_loop detects this situation and does
the proper cleanup.


         if (pid.pid != -1) {
             processed_status = ap_process_child_status(&pid, exitwhy, status);
             if (processed_status == APEXIT_CHILDFATAL) {
                 shutdown_pending = 1;
                 child_fatal = 1;
                 return;
             }
             /* non-fatal death... note that it's gone in the scoreboard. */
             child_slot = find_child_by_pid(&pid);
             if (child_slot >= 0) {
                 for (i = 0; i < ap_threads_per_child; i++)
                     ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD,
                                                         (request_rec *) NULL);



Bill Stoddard wrote:

> This snip of code is in start_threads.  The idea is to scan the scoreboard and find 
>slots
> that have freed up to reuse for the new worker thread.  What happens if a child 
>segfaults
> and leaves bogus status in the ap_scoreboard_image->servers[][i].status field? I 
>quickly
> glanced at the parent process code and did not see anything that detected a child 
>abnormal
> death and reset the scoreboard for that child. Perhaps I just overlooked it... (I 
>don't
> have a lot of time to hack code today...)
> 
> 
>  while (1) {
>         /* ap_threads_per_child does not include the listener thread */
>         for (i = 0; i < ap_threads_per_child; i++) {
>             int status = ap_scoreboard_image->servers[child_num_arg][i].status;
> 
>             if (status != SERVER_GRACEFUL && status != SERVER_DEAD) {
>                 continue;
>             }
> <snip>
>            /* We let each thread update its own scoreboard entry.  This is
>              * done because it lets us deal with tid better.
>              */
>             rv = apr_thread_create(&threads[i], thread_attr,
>                                    worker_thread, my_info, pchild);
> 
> 
> 


-- 
Paul J. Reder
-----------------------------------------------------------
"The strength of the Constitution lies entirely in the determination of each
citizen to defend it.  Only if every single citizen feels duty bound to do
his share in this defense are the constitutional rights secure."
-- Albert Einstein


Reply via email to