On Sun, Dec 6, 2009 at 9:51 AM, André Warnier <a...@ice-sa.com> wrote:
> > I am not the ultimate authority here, but I think you are going to have > several problems with this idea. > - the first one is that under Windows (where Apache also runs) there are no > such signals. > - the second one is that the signal, if signal there is, is probably > addressed to the main Apache instance, not to the children processes. > I am not sure that the Apache main process then tells the children to stop > via a signal, or via some other mechanism. > - assuming that a child process (or thread) has received (from the main > Apache process) the order to terminate, it will do so after it finishes the > current request, by which time it will be too late to add your header. > But maybe I'm wrong with all of these. Let's wait for a guru here to > comment.. > I'm not concerned with Windows. I think all children in the process group see the signals -- at least that's what I'm seeing. Again, I've got keep alives set for a long time. I can start up Apache and make a request with firefox which establishes a connection with one process. Repeated request use the same connection (and process) due to the keep alive. Then I do a graceful stop and just the parent process and that one child process remain. Netstat can also show that the connection is persistent to the child process. That process stays around serving requests until either the client (firefox) closes the connection or a response sends a Connection: close header to the client. Then both the parent and child exit. (I send a Connection: close header when a query parameter is set.) But, if I set a signal handler (either via $SIG or with a POSIX handler) I can catch USR1 in the child process on a graceful stop, but it seems just the act of catching the signal prevents the process from exiting. That is, the query parameter trick can still trigger closing the connection but the process does not exit. So, yes, an IPC and Apache guru would be the next step. ;) -- Bill Moseley mose...@hank.org