Re: CGI-database interaction

Howard, Dan: CIO (howard.dan@ic.gc.ca)
Wed, 29 Jan 1997 14:01:55 -0500


>howard.dan@baznet.ic.gc.ca said:
>>  But if you do a "ps -ef | grep forever" from the unix prompt on the
>> server, you'll see the program is still there, chugging happily away
>> all by itself.  You have to terminate it manually.

Daniel Sherer replied:
>Good work.
>
>What if you set "alarm" to some reasonable number at the top of the 
>program?

AND... Jamie McCarthy replied:
>I've never tried it myself but I'm told that most servers will close the
>CGI's STDIN;  the next time the CGI sends data to STDOUT, unix sends it
>the signal for "broken pipe," er, SIGPIPE I think it is.
>
>Is that not the case on your system?  If not, may I ask what server
>you're running?

Admittedly, I've been getting by with my CGI's so far without using signals 
at all, so have not bothered to figure out how to use them.  The test 
program I mentioned was running on the Netscape Commerce server, with no 
attempt to try to catch signals.  I just wanted to illustrate that the 
browser terminating the connection doesn't mean the CGI program is cut off 
in the middle of whatever it's doing-- it can finish any database (or other) 
transactions it initiated.  I guess listening for ALARM or SIGPIPE, you 
could make it exit with more flexibility.

Dan