manoj 99/11/11 14:57:27
Modified: src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Fix a race condition found by David Colasurdo <[EMAIL PROTECTED]>. We should make sure that the parent notes the creation of a child process in the scoreboard so that perform_idle_server_maintanence doesn't get the chance to claim that slot. Revision Changes Path 1.43 +10 -0 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -u -r1.42 -r1.43 --- mpmt_pthread.c 1999/10/27 06:11:21 1.42 +++ mpmt_pthread.c 1999/11/11 22:57:19 1.43 @@ -1028,8 +1028,18 @@ child_main(slot); } + /* Tag this slot as occupied so that perform_idle_server_maintenance + * doesn't try to steal it */ + (void) ap_update_child_status(slot, 0, SERVER_STARTING, (request_rec *) NULL); + if ((pid = fork()) == -1) { ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, "fork: Unable to fork new process"); + + /* fork didn't succeed. Fix the scoreboard or else + * it will say SERVER_STARTING forever and ever + */ + (void) ap_update_child_status(slot, 0, SERVER_DEAD, (request_rec *) NULL); + /* In case system resources are maxxed out, we don't want Apache running away with the CPU trying to fork over and over and over again. */