Received: by taz.hyperreal.com (8.8.4/V2.0) id JAA21503; Tue, 18 Feb 1997 09:45:17 -0800 (PST) Received: from paris.ics.uci.edu by taz.hyperreal.com (8.8.4/V2.0) with SMTP id JAA21392; Tue, 18 Feb 1997 09:45:01 -0800 (PST) Received: from kiwi.ics.uci.edu by paris.ics.uci.edu id aa17243; 18 Feb 97 8:12 PST To: new-httpd@hyperreal.com Subject: Re: [PATCH] murderous HUP In-reply-to: Your message of "Mon, 17 Feb 1997 19:52:12 MST." Date: Tue, 18 Feb 1997 08:11:57 -0800 From: "Roy T. Fielding" Message-ID: <9702180812.aa17243@paris.ics.uci.edu> Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com Marc Slemko writes: >--- 1030,1086 ---- > for (i = 0; i < HARD_SERVER_LIMIT; ++i) { > int pid = scoreboard_image->servers[i].pid; > >! if (pid != my_pid && pid != 0) { >! int waitret = 0, >! tries = 1; >! >! while (waitret == 0 && tries <= 4) { >! int waittime = 1; /* in usecs */ >! struct timeval tv; Ummm, there is no point in waiting for any less than 1000 usecs, since that's about how long it takes to execute a single instruction on a reasonably fast machine. I suggest starting with 4096 and *8 on each pass. We don't want process swapping to steal all execution time from the children. >! /* don't want to hold up progress any more than >! * necessary, so keep checking to see if the child >! * has exited with an exponential backoff. >! * Currently set for a maximum wait of a bit over >! * four seconds. >! */ >! while (((waitret = waitpid(pid, &status, WNOHANG)) == 0) && >! waittime < 3000000) { >! tv.tv_sec = waittime / 1000000; >! tv.tv_usec = waittime % 1000000; >! waittime = waittime * 2; >! select(0, NULL, NULL, NULL, &tv); >! } What I would suggest is long waittime = 4096; while (((waitret = waitpid(pid, &status, WNOHANG)) == 0) && (waittime > 0) && (waittime < 3000000)) { tv.tv_sec = 0; tv.tv_usec = waittime; waittime << 3; select(0, NULL, NULL, NULL, &tv); } The rest looks fine. .....Roy