While running the bench marking tool, ab (options are -c 30 -n 400), on a cgi script that takes about 30 seconds to complete, I notice the following error in the logfile when I do a graceful shutdown. This is on 2.0.55 version of Apache. The error I get is : [Thu Mar 02 17:23:11 2006] [error] [client 15.42.227.146] daemon couldn't find C GI process for connection 5 [Thu Mar 02 17:23:11 2006] [error] [client 15.42.227.146] daemon couldn't find C GI process for connection 67 For every concurrent request issued, there seems to be an error. I could fix this with some modifications to mod_cgid.c. I found that the httpd process serving the CGI request tries to contact the daemon in the cleanup callback even when a graceful restart has been issued. A check for a graceful restart situation should be made before the connect. The following condition at the beginning of cleanup_script() solves the problem : if (ap_graceful_stop_signalled()) return APR_EGENERAL;
Although this bug was raised against 2.0 in 2006, this behavior still exists on the latest 2.4. It can easily be reproduced by restarting Apache while running a simple curl loop against a phpinfo script (in other words while the server is only handling a single request to the CGI) As ap_graceful_stop_signalled() was removed in 2.3, I suspect a modern equivalent before the connect() in cleanup_script() would be: /* Don't connect while we're shutting down */ if (ap_mpm_query(AP_MPMQ_MPM_STATE, &rc) == APR_SUCCESS && rc == AP_MPMQ_STOPPING) { return APR_EGENERAL; } although I cannot vouch for the appropriateness of the reported workaround.