Re: [users@httpd] CGI Timeouts?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)
	{
	  exit(EXIT_FAILURE);
	}

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

	  /* ... */

	  signal(SIGALRM,timeout_handler);
	  alarm(30);

	/* ... */

	}

  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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux