httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Conner <>
Subject Re: [users@httpd] CGI Timeouts?
Date Wed, 20 Sep 2006 18:16:07 GMT
It was thus said that the Great Steve Swift once stated:
> >But apache won't (can't!) kill the process that's looping...
> The operating system is Linux. The separate threads are spawned as "apache"
> (in our case) but there is still the root process running httpd - that
> should have no problems killing of looping CGI processes, if it wanted to.
> However, I'll accept that "It cannot be done" and continue monitoring for
> looping apache processes.
> If I get motivated I could probably write a cron task to inspect the
> /server-status webpage every two minutes and to kill off any thread that
> seems to be hogging the system.

  You could always include the login in the CGI script itself.  Admittedly
it's a hack, but it would work.  For example, in C (which I know too well
and for a quick example, I'm not going to look up how to do this in Perl or
PHP but I can't see it being much different):

	#include <stdlib.h>
	#include <unistd.h>
	#include <signal.h>

	static void timeout_handler(int sig)

	int main(int argc, char *argv[])

	  /* ... */


	/* ... */


  alarm() will set a signal (SIGALRM) to trigger in X seconds (in this case,
30).  We set the signal handler for SIGALRM to just terminate the program.

  -spc (And this would probably be easier than writing another program that
	runs looking for programs to kill ... )

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message