This is definitely in 2.0 and I believe it is in 1.3 as well.

If the Apache child process segfaults while any other process it started is running 
(CGI,
rotatelogs, etc,), there is a chance that the server will stop serving pages, even 
after a complete
shutdown and restart of Apache. The problem is twofold...

1. When an Apache (for Windows) child process segfaults, any processes it started are 
stranded and
not cleaned up. The Win32 API does not provide any facilities to tell the system to 
kill off any
child processes when the parent dies abnormally.  This is the least serious part of 
the problem.

2. This is the nasty part... Due to a bug in the Windows part of Apache, child 
processes are
inheriting open socket descriptors. When the Apache child process segfaults, its child 
processes
have copies of the open socket descriptors which can prevent the new Apache process 
from accepting
connections..  This could explain some long standing bug reports in the bugdb.

Solutions...
Sockets are created as inheritable by default. We need to use DuplicateHandle to create
noninheritable handles of the listeners.  This is a bit tricker than it first appears 
and I spent
the better part of this AM getting this to work. There are some funky race conditions 
between
CreateProcess() (to create the Apache child process) and WSADuplicateSocket() that 
will, if not
handled properly, undo any effort to make the listeners noninheritable.

I have no thoughts on how to cleanly solve problem 1.  Would be nice if there were 
some system calls
to bind the two processes together in a parent/child relationship.

Workarounds:
Reboot :-(  or if you are familier enough with the processes Apache starts on your 
system, shutdown
Apache then search and destroy the leftover processes (rotatelogs, CGI, etc.) that 
Apache should
have cleaned up. If you do a netstat -an and still find a listener on your webserver 
port, you
missed something.

Bill

Reply via email to