At 02:02 PM 02/26/01 +0000, Steve Hay wrote:
>I have a script which I wish to run under either mod_perl or CGI which does
>little more than display content and I would like it to stop when the user
>presses Stop, but I can't get it working.

You need to do different things under mod_perl and mod_cgi.  Refer to the
Guide for running under mod_perl -- you probably should check explicitly
for an aborted connection as the guide shows.

[This is all from my memory, so I hope I have the details correct]

Under mod_cgi Apache will receive the SIGPIPE when it tries to print to the
socket.  Since your CGI script is running as a subprocess (that has been
marked "kill_after_timeout", I believe), apache will first close the pipe
from your CGI program, send it a SIGTERM, wait three seconds, then send a
SIGKILL, and then reap.  This all happens in alloc.c, IIRC.

This is basically the same thing that happens when you have a timeout.

So, you can catch SIGTERM and then have three seconds to clean up.  You
won't see a SIGPIPE unless you try to print in that three second gap.  

Does it do the same thing under NT?




Bill Moseley
mailto:[EMAIL PROTECTED]

Reply via email to