0

This is an odd problem I am having, after about 60 seconds (timed 4 times). I am running a loop that does a HTTPService call (only takes a couple of sec) and when it's all finished it goes back to the function and repeats adding to a counter.

Code works for smaller test samples (never got above 92 items). Item in my case are folder names.

Is there some sort of a timeout with code that doesn't require user input? I have checked my code many times now but there's nothing that shouldn't work.

DominicM
  • 6,520
  • 13
  • 39
  • 60
  • are you seeing a script timeout error? or it just quits making the call back on itself again? if it's a timeout error, you can get around than by periodically exiting the loop and adding a callLater() or Timer. Prevents synchronous locking. But if just quits calling back, there may be something else wrong that causes it to not make the next callback. – Jason Reeves Jan 09 '13 at 16:19
  • No I get no errors, debugging traces just freeze and no calls happen any more. I've also checked the service but I always get http 200 so that cant be it, can't imagine what else it could be... – DominicM Jan 09 '13 at 16:26
  • ah... I bet you are running into a browser timeout issue in your debugger. what OS / browser are you using and I'll tell you how to fix it... better yet, just google your browser type and flex debugger timeout... you'll see a bunch of tutorials on how to fix it – Jason Reeves Jan 09 '13 at 16:50
  • This is an AIR app so it doesn't run in a browser, or did you mean something else? – DominicM Jan 09 '13 at 17:05
  • no, I missed that ("AIR") in the title... it was a thought. – Jason Reeves Jan 09 '13 at 17:14

3 Answers3

0

Maybe the service is blocking you, because it is suspicious..

csomakk
  • 5,369
  • 1
  • 29
  • 34
  • Service is on my own server(php) so no it's not. I even checked by having sleep function in the php service that changed the amount of items processed but not the time when it stopped executing. – DominicM Jan 09 '13 at 15:53
0

ok this became interesting to me and I found this:

"The max-execution-time value specifies the maximum duration, in seconds, that an ActionScript event handler can execute before Flash Player assumes that it is hung, and aborts it. The default value is 60 seconds. You cannot set this value above 60 seconds."

so, my comment about breaking up using a timer is probably your best solution.

Jason Reeves
  • 1,716
  • 1
  • 10
  • 13
  • Yes, but it could be very different in air, but there's almost no documentation on air apps... Does this apply to any code that runs without user input or just loops (for loop for example). I removed for loop in favour of event callback and now it seems to execute longer (well above 60 sec), though still stalled possibly for different reason. It's at 400 items now of 2072 will see if it runs till the end on this folder. – DominicM Jan 09 '13 at 17:34
  • yes it said that is for AIR also... (I searched for AIR to find that answer). The answer is right about what's wrong... now how to overcome it I think will take the trial and error with timing / events like you are doing. – Jason Reeves Jan 09 '13 at 17:40
  • also just found this link which is a solution to a problem that sounds very similar to your. [Link Here](http://blogs.infosupport.com/flex-4-a-multi-threading-solution/) – Jason Reeves Jan 09 '13 at 17:43
  • So I guess an even is considered same as user interaction even when it is dispatched manually? Loop is at 1200 so looks like other folder was just a fluke or other issue. Second look will take much longer so will update after it finishes. – DominicM Jan 09 '13 at 17:47
0

In the end it turned out to be an error in the way loops were used. It was just a coincidence that it stopped running at about 60 seconds. I solved it by breaking up the series of loops into functions that call the next step/function when all requests are completed instead of right away.

DominicM
  • 6,520
  • 13
  • 39
  • 60