mpm_common.c revision 836d6aa72d33f9bfc8e277577824d4103fc10173
2N/A/* ==================================================================== 2N/A * The Apache Software License, Version 1.1 2N/A * Copyright (c) 2000-2002 The Apache Software Foundation. All rights 2N/A * Redistribution and use in source and binary forms, with or without 2N/A * modification, are permitted provided that the following conditions 2N/A * 1. Redistributions of source code must retain the above copyright 2N/A * notice, this list of conditions and the following disclaimer. 2N/A * 2. Redistributions in binary form must reproduce the above copyright 2N/A * notice, this list of conditions and the following disclaimer in 2N/A * the documentation and/or other materials provided with the 2N/A * 3. The end-user documentation included with the redistribution, 2N/A * if any, must include the following acknowledgment: 59N/A * "This product includes software developed by the 2N/A * Alternately, this acknowledgment may appear in the software itself, 2N/A * if and wherever such third-party acknowledgments normally appear. 2N/A * 4. The names "Apache" and "Apache Software Foundation" must 2N/A * not be used to endorse or promote products derived from this 2N/A * software without prior written permission. For written 2N/A * permission, please contact apache@apache.org. 2N/A * 5. Products derived from this software may not be called "Apache", 59N/A * nor may "Apache" appear in their name, without prior written 59N/A * permission of the Apache Software Foundation. 2N/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 2N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2N/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26N/A * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 26N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26N/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 38N/A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 181N/A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26N/A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26N/A * ==================================================================== 26N/A * This software consists of voluntary contributions made by many 26N/A * individuals on behalf of the Apache Software Foundation. For more 26N/A * information on the Apache Software Foundation, please see 26N/A * Portions of this software are based upon public domain software 26N/A * originally written at the National Center for Supercomputing Applications, 151N/A * University of Illinois, Urbana-Champaign. 26N/A/* The purpose of this file is to store the code that MOST mpm's will need 26N/A * this does not mean a function only goes into this file if every MPM needs 26N/A * it. It means that if a function is needed by more than one MPM, and 26N/A * future maintenance would be served by making the code common, then the 26N/A * function belongs here. 2N/A * This is going in src/main because it is not platform specific, it is 26N/A * specific to multi-process servers, but NOT to Unix. Which is why it 46N/A /* don't want to hold up progress any more than 46N/A * necessary, but we need to allow children a few moments to exit. 64N/A * Set delay with an exponential backoff. 46N/A /* now see who is done */ 26N/A case 3:
/* 344ms */ 145N/A /* ok, now it's being annoying */ 84N/A "child process %ld still did not exit, " 99N/A case 8:
/* 6 sec */ 99N/A /* die child scum */ 99N/A "child process %ld still did not exit, " 46N/A "sending a SIGKILL",
32N/A /* sending a SIGKILL kills the entire team on BeOS, and as 32N/A * httpd thread is part of that team it removes any chance 32N/A * of ever doing a restart. To counter this I'm changing to 32N/A * use a kinder, gentler way of killing a specific thread 32N/A * that is just as effective. 38N/A case 9:
/* 14 sec */ 38N/A /* gave it our best shot, but alas... If this really 38N/A * is a child we are trying to kill and it really hasn't 38N/A * exited, we will likely fail to bind to the port 38N/A * after the restart. 38N/A "could not make child process %ld exit, " 38N/A "attempting to continue anyway",
26N/A /* nothing left to wait for */ 32N/A#
endif /* AP_MPM_WANT_RECLAIM_CHILD_PROCESSES */ 32N/A/* number of calls to wait_or_timeout between writable probes */ #
endif /* AP_MPM_WANT_WAIT_OR_TIMEOUT */ /* Child died... if it died due to a fatal error, * we should simply bail out. The caller needs to * check for bad rc from us and exit, running any * If the child died due to a resource shortage, * the parent should limit the rate of forking "child pid %ld exit signal %s (%d), " "possible coredump in %s",
"child pid %ld exit signal %s (%d)",
#
endif /* AP_MPM_WANT_PROCESS_CHILD_STATUS */ /* The Nagle algorithm says that we should delay sending partial * packets in hopes of getting more data. We don't want to do * this; we are not telnet. There are bad interactions between * persistent connections and Nagle's algorithm that have very severe * performance penalties. (Failing to disable Nagle is not much of a * problem with simple HTTP.) * In spite of these problems, failure here is not a shooting offense. "setsockopt: (TCP_NODELAY)");
/* QNX, MPE and BeOS do not appear to support supplementary groups. */ #
endif /* def NEED_INITGROUPS *//* This function connects to the server, then immediately closes the connection. * This permits the MPM to skip the poll when there is only one listening * socket, because it provides a alternate way to unblock an accept() when /* create a temporary pool for the socket. pconf stays around too long */ "get socket to connect to listener");
/* on some platforms (e.g., FreeBSD), the kernel won't accept many * queued connections before it starts blocking local connects... * we need to keep from blocking too long and instead return an error, * because the MPM won't want to hold up a graceful restart for a "set timeout on socket to connect to listener");
/* probably some server processes bailed out already and there * is nobody around to call accept and clear out the kernel * connection queue; usually this is not worth logging /* we don't write anything to the pod here... we assume * that the would-be reader of the pod has another way to * see that it is time to die once we wake it up * writing lots of things to the pod at once is very * problematic... we can fill the kernel pipe buffer and * be blocked until somebody consumes some bytes or * we hit a timeout... if we hit a timeout we can't just * keep trying because maybe we'll never successfully * write again... but then maybe we'll leave would-be * readers stranded (a number of them could be tied up for * a while serving time-consuming requests) #
endif /* #ifdef AP_MPM_USES_POD *//* standard mpm configuration handling */ return "PidFile directive not allowed in <VirtualHost>";
" does not exist",
NULL);
" is not a directory",
NULL);
"Valid accept mutexes for this platform and MPM are: default" /* perchild can't use SysV sems because the permissions on the accept * mutex can't be set to allow all processes to use the mutex and * at the same time keep all users from being able to dink with the