httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <>
Subject nasty bug in Apache for Windows (1.3 & 2.)
Date Thu, 12 Jul 2001 18:18:16 GMT
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
shutdown and restart of Apache. The problem is twofold...

1. When an Apache (for Windows) child process segfaults, any processes it started are stranded
not cleaned up. The Win32 API does not provide any facilities to tell the system to kill off
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.

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
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
to bind the two processes together in a parent/child relationship.

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


View raw message