Re: fastcgi processes start but the web server doesn't

Stanley Gambarin (gambarin@openmarket.com)
Fri, 13 Dec 1996 13:49:49 -0500

Message-Id: <199612131849.NAA15144@u4-138.openmarket.com>
To: Michael Smith <mjs@cursci.co.uk>
Subject: Re: fastcgi processes start but the web server doesn't 
In-Reply-To: Your message of "Fri, 13 Dec 1996 09:54:44 GMT."
             <32B127E4.372A3F46@cursci.co.uk> 
Date: Fri, 13 Dec 1996 13:49:49 -0500
From: Stanley Gambarin <gambarin@openmarket.com>

> Interesting little problem just discovered for apache mod_fastcgi.  If
> the web server does not have permission to write to the log files, httpd
> processes don't start up; however fastcgi processes do.  This is with
> apache 1.2b1.
> 
> Mike

	Above statement is indeed true due to Apache's implementation.
The Apache call's the initialization routines for the modules before it 
actually opens any log files.  Since mod_fastcgi spawns another process
(the FastCGI process manager) in it's initialization routine, the server
dies, but the FastCGI does not.  There are a number of ways to "fix" the
problem, some of which are listed below:

	- since init routine for mod_fastcgi is called from read_config 
function, which is actually called twice, we can keep a variable inside
the initialization routine to only spawn FCGI process manager on the second
try.  This however breaks, when you are running in the debug mode, in which
case, you will not be able to start any FastCGI procs (very bad).
	- patch Apache code to open it's logs (call to open_logs()) to be 
made before the call to read_config(), which calls initialization routines
in the modules.
	- another alternative is to check for parent pid of the 
FastCGI process manager usign getppid().  If it is 1 (no parent), then 
we can assume that httpd daemon is not running and die.

	For now, I am open  to suggestions as to other ways to "fix" this
bug, which will then hopefully make it into next patch for mod_fastcgi.
				
							Stanley.
	
-- 

*******************************************************************************
* Stanley Gambarin			Open Market Inc.		      *
* FastCGI (soon-to-be) Guru		245 First St. Cambridge MA 02142      *
*					(617) - 949 - 7487		      *
* mailto:gambarin@openmarket.com					      *
* 				http://acs2.bu.edu:8001/~stanleyg (school)    *
*				mailto:stanleyg@cs.bu.edu		      *
*******************************************************************************