Perl 5.003 stalling problem

Karl Petty (pettyk@EECS.Berkeley.EDU)
Wed, 14 Aug 1996 17:35:29 -0700

Date: Wed, 14 Aug 1996 17:35:29 -0700
From: Karl Petty <pettyk@EECS.Berkeley.EDU>
Message-Id: <199608150035.RAA21994@paleale.eecs.berkeley.edu>
To: fastcgi-developers@openmarket.com
Subject: Perl 5.003 stalling problem


I've sort of have fastCGI working on my system but it seems to do weird
things.  The test script that I wrote that just does the counting thing
sometimes works and sometimes it doesn't.  It seems that just about
every other time I run it the thing fails.  The browser just seems to
be waiting for text - it just says that it's stalled.  Sometimes it gets
halfway through the text on the HTML page and then stops and stalls.  

I put in little log writing steps in my script so that I could see if
the script was running and it was.  I even selected stdout and set $| =
1 so that there was no buffering but to no avail.  I noticed that if I
kill the scripts while the browser is stalling then the transfer of the
page completes and the browser returns.  Weird.

Has anybody encountered this problem before?  I've installed the NCSA
1.5.2 server and I'm running perl 5.003 with the FCGI support compilied
in.  Was this a problem with the server or with perl?  I've listed the
program below.

Thanks.

	Karl


PS:  Also, why does this program run as root instead of as the server
process ID?  Do I just have it configured incorrectly?


#!/usr/paleale/bin/perl
 
$count = 0;
use CGI::Fast;
while (($ignore) = each %ENV) {
}
WriteLog("started");
 
while ($query = new CGI::Fast) {
 
        WriteLog("access");
 
        select(STDOUT);
        $| = 1;
        print $query->header, "\n";
        print $query->start_html(-title => "Great form");
        print $query->startform("POST", "/fcgi-bin/test.fcgi");
        print "<h1>CGI Script</h1>\n";
        print "Not much to see here: ", ++$count, "\n";
        print "<hr>\n";
        print $query->submit(-value=>'Try this again', -name=>'admin'), "\n";
        print $query->endform, "\n";
        print $query->end_html, "\n";
}
 
WriteLog("died");
 
sub WriteLog {
        my($someString) = @_;
        open(LOG_PTR, ">> /tmp/t1.fcgi");
        print LOG_PTR "$someString: ", scalar localtime(time), " \n";
        close(LOG_PTR);
}

=================================================================
Karl Petty                                    Tel: (510) 643-5887
Electrical Engineering                        FAX: (510) 642-6330
UC Berkeley                              pettyk@eecs.berkeley.edu
Berkeley CA 94720       http://paleale.eecs.berkeley.edu/~pettyk/
=================================================================