You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2005/04/04 19:00:16 UTC

Re: Flushing lingering CGI processes

Nick wrote:
> Hello
> 
> Firstly, thank you to everyone who has contributed to the great apache 
> project.
> 
> I understand that if a CGI process is launched then gets stuck, if the 
> CGI process keeps quiet, the apache server will not 'know' the http 
> connection has broken so will not 'know' to kill the CGI process. The 
> stuck CGI process and the accompanying apache process will then 
> needlessly use system resources indefinately.
> 
> In a worst case scenario, the stuck CGI process will lock some server 
> resource possibly causing many other CGI processes to get stuck, 
> bringing the server down. (I attribute a recent crash to this).
> 
> A great solution for administrators would be to set a timer. If the CGI 
> program hasn't given any output for the given time, the CGI process is 
> killed.

Nick, take a look at the perl module Apache::Watchdog::RunAway
http://search.cpan.org/dist/Apache-Watchdog-RunAway/
http://search.cpan.org/dist/Apache-Watchdog-RunAway/RunAway.pm
which does exactly what you want and comes with a little daemon.

To operate it needs to be able to fetch the scoreboard, which can be done 
by either Apache::Scoreboard if you run mod_perl, or by a stand-alone C 
module mod_scoreboard_send.c. Both live here:
http://search.cpan.org/dist/Apache-Scoreboard/

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com