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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Process Timing Out?

Status
Not open for further replies.

Krel

Programmer
Feb 3, 2002
135
0
0
CA

Try going to this URL. When you enter a small value in the "random ticket" field and submit, it works fine. But if you enter a larger value - around 100 or 200 - the perl process always times out. FYI, this prog isn't especially CPU-intensive or anything. However, when I run it on a webserver that is not mine (hypermart), large values (up to around 10,000 or more) will work fine. Any reason why this would time out?
 
Hi mate,

How long is this taking you to finish running the script and display the results?

I have tried it and it is still running, I'm on a cable modem and over 2 minutes have went by.....

Look for the following in your httpd.conf and change it to a higher value.

Timeout 300

Hope this helps Wullie

 
Hey there,
It would be helpful for you to post some of the code for this.
 
That's the thing, the perl process just continues indefinitely. I checked the tasks running this morning and there were around 8 Perls.

But see the comparison: the following is the exact same program, but it never times out. Give it a try.


Although I can't see how the code could be the problem, here's the part that would probably take the longest:

Code:
sub GenerateRandomNumbers {
  my ($SuccessfulTickets,@RandomTickets); 
  my $NumOfTickets = shift; 
  until ($NumOfTickets == $SuccessfulTickets) {
    my ($GenError,@Numbers,@NumbersToAdd); 
    for (0..5) {
      $Numbers[1][$_] = int(rand 49) + 1;
    }
    $GenError = CheckDuplicatesAndErrors(@Numbers);
    unless ($GenError) {
      for (0..5) {
        $NumbersToAdd[$_] = $Numbers[1][$_];
      }
      push @RandomTickets,\@NumbersToAdd; # Adds the new numbers to the list of tickets
      $SuccessfulTickets++; 
    }
  }
  return @RandomTickets;
}

Also, about the timeout setting, this is supposed to be a program that executes in a couple of seconds... It executing after 500 seconds instead of 300 probably won't help. :) Any ideas why entering, say, 25 would work, but 100 would not?
 
I don't see anything wrong with the snippet above....

....a shot in the dark.....
The symptom sounds like you might have some nested loops of some sort causing your "increase in input numbers" to explode into a "lot of loops executed" ..... it works well for small numbers.... bogs down on larger numbers.


Can you post a concise version of the code that is calling the sub routine you posted above? 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top