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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.