Re: Recycling FastCGI processes
Mark Brown (mbrown@OpenMarket.com)
Wed, 05 Jun 1996 19:17:10 -0400
Message-Id: <199606052317.TAA16033@breckenridge.openmarket.com>
To: fastcgi-developers@OpenMarket.com
Subject: Re: Recycling FastCGI processes
Date: Wed, 05 Jun 1996 19:17:10 -0400
From: Mark Brown <mbrown@OpenMarket.com>
Rujith S. de Silva asks:
For various reasons, such as a small memory leak, one might wish to have
a FastCGI process handle (say) a thousand requests, and then gracefully
exit, so that the server would restart it. Can this be done? Can this
be done in Perl? I tried:
while ($count < $num_hits && FCGI::accept >= 0)
{
handle_request ();
++$count;
}
exit (0);
But it seems that the LAST request handled before the exit gets munged.
In hindsight, this was to be expected. I tried messing with
FCGI::set_exit_status () to no avail.
So I guess my question is: how does one tell the FCGI libs that one has
finished processing the current request, but does NOT want to handle
another request?
Funny you should ask. The next version of the app libraries
includes the "Finish" call (FCGI_Finish, FCGX_Finish, FCGI::finish, etc.)
What Finish does is to finish the current request without starting
a new one. When you are ready to start a new one you call
Accept as usual. Or, in your case, you exit and start a new
process that calls Accept.
Expect a new kit later this week.
--mark