Hi, I didn't follow the full email thread so I apologise if this is off-topic. Apache 1.3.x definetly has support for looping CGI apps - see src/main/alloc.c:alloc.c:free_proc_chain(). When a new CGI app is spawned, it is registered in this 'proc chain' list and when timeout occurs at cgi handler (mod_cgi.so), it kills all such errant processes - it tries graceful signal first, and eventually 'kill -9' if necessary. Since I see threads mentioned here, I am sure this feature is supported in apache 2x also. Regards, Ravi On 9/20/06, Sean Conner <spc@xxxxxxxxxx> wrote:
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
--------------------------------------------------------------------- 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