--- apache_1.3.28/src/main/alloc.c.orig Sun Jul 20 13:34:23 2003 +++ apache_1.3.28/src/main/alloc.c.orig Sun Jul 20 13:34:37 2003 @@ -2859,49 +2859,18 @@ if ((p->kill_how == kill_after_timeout) || (p->kill_how == kill_only_once)) { /* Subprocess may be dead already. Only need the timeout if not. */ - if (ap_os_kill(p->pid, SIGTERM) == -1) { - p->kill_how = kill_never; - } - else { + if (ap_os_kill(p->pid, SIGTERM) != -1) need_timeout = 1; - } } else if (p->kill_how == kill_always) { kill(p->pid, SIGKILL); } } - /* Sleep only if we have to. The sleep algorithm grows - * by a factor of two on each iteration. TIMEOUT_INTERVAL - * is equal to TIMEOUT_USECS / 64. - */ - if (need_timeout) { - timeout_interval = TIMEOUT_INTERVAL; - tv.tv_sec = 0; - tv.tv_usec = timeout_interval; - ap_select(0, NULL, NULL, NULL, &tv); + /* Sleep only if we have to... */ - do { - need_timeout = 0; - for (p = procs; p; p = p->next) { - if (p->kill_how == kill_after_timeout) { - if (waitpid(p->pid, (int *) 0, WNOHANG | WUNTRACED) > 0) - p->kill_how = kill_never; - else - need_timeout = 1; - } - } - if (need_timeout) { - if (timeout_interval >= TIMEOUT_USECS) { - break; - } - tv.tv_sec = timeout_interval / 1000000; - tv.tv_usec = timeout_interval % 1000000; - ap_select(0, NULL, NULL, NULL, &tv); - timeout_interval *= 2; - } - } while (need_timeout); - } + if (need_timeout) + sleep(3); /* OK, the scripts we just timed out for have had a chance to clean up * --- now, just get rid of them, and also clean up the system accounting