Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Perl Monks,
I am asking this question again to see if anyone has experienced the same problem. I have a Perl script that invoke s an external C program and periodically retrieves data back from the external program. The script then sends these data to the web browser (Netscape or Firefox) for display. The process takes about 9000 seconds to finish. Unfortunately, the perl script always lost the connection to the web browser and die but the C program is still running. When everything is working as it supposed to, I would see two processes running when I type in ps -aux on the linux box:
apache 19482 0.9 0.3 5808 3792 ? S 00:27 0:00 /usr/bin/perl /var/www/cgi-bin/asyn.cgi
apache 19483 0.0 0.3 147384 3436 ? Sl 00:27 0:00 ./exe /var/www/html/cgi_data/input100
but after it lost the connection to the web browser, I only get:
apache 19483 0.0 0.3 147384 3436 ? Sl 00:27 0:00 ./exe /var/www/html/cgi_data/input100
I have changed the timeout in the hpttd.conf file to 300000 and the network.http.connect.timeout in firefox config to 300000 but no luck. This is my actual code:
#!/usr/bin/perl
use warnings;
use HTML::Template;
use CGI qw(:standard);
$| = 1;
print "Content-type: multipart/x-mixed-replace;";
print "Connection: Keep-Alive";
print "boundary=magicalboundarystring\n\n";
print "--magicalboundarystring\n";
$com = "./exe /var/www/html/cgi_data/input100";
open PIPE, "$com |";
$count = 0;
$totalw = 0;
$totalr = 0;
while ($data = <PIPE>)
{
#my ($read, $write, $update, $complete) = split(/::/,$data);
my ($marker, $wt1, $successw1, $maxw1, $failw1, $rt1, $successr1, $maxr1,
$failr1, $utime1, $successu1, $maxu1, $failu1, $done) = split(/::/, $data);
$totalw = $totalw + $wt1;
$totalr = $totalr + $rt1;
$count++;
print "Content-type: text/html\n\n";
print "Users created: $done\n";
print "\n";
print "Write Time: $totalw\n";
print "\n";
print "Read Time: $totalr\n";
print "\n";
print "seconds: $count";
print "\n--magicalboundarystring\n";
}
print "Content-type: text/html\n\n";
print "Connection: Close";
print "Percent completed: $done\n";
print "\n";
print "Write Time: $totalw\n";
print "\n";
print "Read Time: $totalr\n";
print "\n";
print "seconds: $second";
print "--magicalboundarystring--\n";
close(PIPE);
Any assistance would be appreciated.
Thanks.