Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hung Results Page

Status
Not open for further replies.

max1x

Programmer
Jan 12, 2005
366
US
I have a script that is called from the cgi page to be ran on a remote machine, results of which are displayed in the html page it's self.

On the cgi page I have $| = 1 and am using telnet module with Timeout set to 700, since the remote script can take quite some time to finish.

Code:
#!/path/to/perl

use CGI;
use CGI::Carp('fatalToBrowser');
use CGI(:/standard/);
$| = 1;

$remoteHost = param('remoteHostIp');
chomp ($remoteHost);
print "$remoteHost;
&postCheck();

sub postCheck() {
$tlOp = new Net::Telnet(Timeout=>700);
....
@targetdata = $tlOp->cmd("runRemoteScript"); 
if (@targetdata) {
    print "@targetdata";
} else {
    print "What Happened";
  }
}

The problem is that the cgi page just hangs while the remote script has completed execution and most or time takes about 600-650 seconds. This does not happen on all remote machines, only the ones that take quite a while for the remote script to complete.

Any ideas?
 
There's probably a setting on the apache server for how long it takes to time out the loading of each web page.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
options maybe to run a cron job at specified intervals and just pick up the datafile on each request.

If there's a webserver on the remote machine, just call an iframe or a frame on that script

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
travs69:
I looked at the httpd.conf and did not find any time out. But reasearched and found that Apache has changed the default timeout from 1200 to 300.

PaulTEG:
The scripts on the remote machine are ran only when the users desire to do so, so I can't cron it. The remote machine is like a dumb terminal, processing data and has no web configured on it.

Is there something I can do after this:
Code:
@targetdata = $tlOp->cmd("runRemoteScript");
to keep the connection alive? I don't know if sending a ping every 100 secs would do the trick, which I'll try.
 
Instead of running the script on demand, have the user go to a web page that creates a "job", give them a job number, and a page that refreshes till the job is done. Put that job in a file and have a cron that runs, reads the file, does the job and puts the output somewhere. You can even have it update the status to the user. "Job submitted", "Job Running", "Job completed" etc..

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
what sort of a job takes 5-6 minutes to run as interactive procedure through a web server? if the job runs every 15 minutes at peak times and every hour off peak, on a cron, they can have the results straight away, though they may be off by a few minutes.

When the architecture of what you've created isn't suited to the environment, then it's either time for trade offs or back to the drawing board.

Are there improvements to the procedures which could speed the process up?


Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top