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);