Re: CERN HTTPD : does it kills cgi childs?

Ari Luotonen (luotonen@neon.mcom.com)
Tue, 29 Nov 1994 09:59:41 -0800 (PST)


> I have a relativly large application started as CGI script from
> cern httpd 3.0x. My question is : If the client drops the connection
> *and* the server notice that before the script was finished , sends
> the server a signal (and which) to the cgi process or not? How can
> I ensure that a script is not terminated by the server in a critical
> section and leave a database corrupt?(okay, i could catch the signals,
> but is there another way?)

The only time that httpd kills the script is if it times out
(ScriptTimeOut directive if I recall). It then first sends TERM,
waits 5 seconds, and then sends KILL.

If the client has disconnected from the server, then the server will
catch SIGPIPE when it's doing the next write to the socket, and exit.
It doesn't send a signal to the script then, but leaves the script
running (maybe this could be thought of as a bug, too).

If you want to be sure that your CGI script is unaffected by kills, do
an extra fork to obtain a new pid so the server can't send it TERM and
KILL.

-- Cheers, Ari --