Graceful Exit?

Jim Boutcher (
Tue, 4 Mar 1997 03:51:50 -0600

Message-Id: <>
From: Jim Boutcher <>
To: "''"
Subject: Graceful Exit?
Date: Tue, 4 Mar 1997 03:51:50 -0600

I have an CGI that updates a logfile everytime it's ran... I'm porting =
it to FastCGI, and have some questions..

1) I am trying to take advantage of FastCGI by storing multiple log =
entries in memory, and when I get 10 or so, write them out to the =
logfile. This will (obviously) cut down the number of times this file is =
opened and file i/o occurs by 1/10th. =20

2) My problem arises when I wish to kill the web server or for some =
reason the FastCGI process dies(has never happened to me yet, but I've =
heard it happens).. If I have buffered 9 log entries, they are all lost. =
It seems to me that the code outside of the FCGI_Accept while loop is =
never executed.=20

3) Am I overlooking something? How do I make sure code is ran on process =
termination? It would make my life so much easier (and all my CGIs =
EXTREMELY quicker) if I could "buffer" all file i/o in my FastCGI =
processes. Has anyone done this?=20

Jim Boutcher