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: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to