Re: fastCGI, memory leaks etc
Steve Kann (stevek@io360.com)
Mon, 19 Aug 1996 12:20:05 -0400 (EDT)
From: Steve Kann <stevek@io360.com>
Message-Id: <199608191620.MAA12678@spheara.io360.com>
Subject: Re: fastCGI, memory leaks etc
To: mjs@cursci.co.uk (Michael Smith)
Date: Mon, 19 Aug 1996 12:20:05 -0400 (EDT)
In-Reply-To: <321878F5.4B081A7D@cursci.co.uk> from "Michael Smith" at Aug 19, 96 03:23:49 pm
>
> The boy Nigel wrote:
>
> >Exit your process explicitly after n connections - something like
> >this at the end of the loop
> >
> > if (count++ > 100)
> > exit(0);
> >
> >The problem with your code is first you accepted the connection, then
> >you dumped out of the processing loop.
>
> I have tried achieving the desired effect with the following piece of
> perl:
>
> my($count)=0;
>
> while (FCGI::accept() >= 0) {
> $count++;
> print "Content-type: text/html\n\nCount=$count\n";
> if ($count > 3) {
> exit(0);
> }
> }
>
> But this gives me a server error every forth time. Any way of avoiding
> this undesirable effect would be much appreciated.
>
> Mike
>
you need to call FCGI::finish() before exit(), like this:
# don't run for too long.
$count++;
print "<!-- fastcgi-process-count: $count -->\n";
if($count > 5)
{
FCGI::finish();
exit(0);
}
-SteveK