fielding 00/01/11 19:38:25
Modified: src CHANGES src/main http_main.c Log: this patch is intended to avoid a problem witnessed in apache installations with certain third party libraries: if there are many children, and then take sufficiently long to shut down, then apache's reclaim child processes sends the remaining children SIGKILL. that's alright with me -- shutdown shouldn't take so long -- but the current code doesn't wait around for them to die; if they haven't all finished terminating right away, it sleeps for approximately 16 seconds before noticing that they're dead. thus, the total time required to shut down is generally a bit more than twenty seconds ... the last 16 seconds of which is quite unnecessary. anyway, what this patch does is change things so that after SIGKILL has been sent, the parent checks a couple of times (approx: 16ms, 84ms, 350ms, 1.4sec) and then decides that the SIGKILL failed. i could easily adjust this so that the total time spent waiting for the SIGKILL to fail is what it was -- 16 seconds, give or take -- but in writing this, i figured that if they haven't died after 1.4 seconds, then the SIGKILL wasn't sufficient; it's not instant, but it should never take that long. Submitted by: Ed Korthof <[EMAIL PROTECTED]> Reviewed by: Roy Fielding Revision Changes Path 1.1496 +5 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1495 retrieving revision 1.1496 diff -u -r1.1495 -r1.1496 --- CHANGES 2000/01/12 01:15:20 1.1495 +++ CHANGES 2000/01/12 03:38:14 1.1496 @@ -1,5 +1,10 @@ Changes with Apache 1.3.10 + *) Reduce the time that a parent waits for its children to die + after SIGKILL has been sent, since there isn't much point in waiting + another 16 seconds beyond the initial SIGTERM waiting period. + [Ed Korthof] + *) Revert to the 1.3.3 way of getting the server name from the scoreboard, with a modification to make it respect the UseCanonicalName setting. This makes things work better with 1.488 +7 -2 apache-1.3/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.487 retrieving revision 1.488 diff -u -r1.487 -r1.488 --- http_main.c 2000/01/12 01:13:23 1.487 +++ http_main.c 2000/01/12 03:38:19 1.488 @@ -2380,7 +2380,7 @@ ap_sync_scoreboard_image(); - for (tries = terminate ? 4 : 1; tries <= 9; ++tries) { + for (tries = terminate ? 4 : 1; tries <= 12; ++tries) { /* don't want to hold up progress any more than * necessary, but we need to allow children a few moments to exit. * Set delay with an exponential backoff. @@ -2435,8 +2435,13 @@ "child process %d still did not exit, sending a SIGKILL", pid); kill(pid, SIGKILL); + waittime = 1024 * 16; /* give them some time to die */ break; - case 9: /* 14 sec */ + case 9: /* 6 sec */ + case 10: /* 6.1 sec */ + case 11: /* 6.4 sec */ + break; + case 12: /* 7.4 sec */ /* gave it our best shot, but alas... If this really * is a child we are trying to kill and it really hasn't * exited, we will likely fail to bind to the port