3

I'm getting an error after 30 seconds of execution of this service

<s:HTTPService id="svcList" url="http://localhost/index.php" method="GET" result="svcList_resultHandler(event)" fault="svcList_faultHandler(event)" requestTimeout="300">
    <s:request xmlns="">
        <mod>module</mod>
        <op>operation</op>
    </s:request>
</s:HTTPService>

This operation takes longer than usual so I changed the max execution time for php to 120 seconds.

The script runs correctly when is requested through a browser i.e http://localhost/index.php?mod=module&op=operation

I've already checked the fault event object for an answer and find this at faultDetails Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost/index.php" errorID=2032]. URL: http://localhost/index.php

Is there a execution time limit for requests ?

Edit: Using requestTimeout already.

Thanks

gustyaquino
  • 767
  • 1
  • 7
  • 28

3 Answers3

10

Ok, in my working environment (Flex SDK 4.1 - AIR 2.6) simply using requestTimeout="xx" doesn't work I don't know why.

But setting a very global object URLRequestDefaults property idleTimeout works as I need.

The solution for my proble is this configuration, at the top of the application.

import flash.net.URLRequestDefaults;

URLRequestDefaults.idleTimeout = 120000; //note this value represents milliseconds (120 secs)

I believe this could help somebody.

gustyaquino
  • 767
  • 1
  • 7
  • 28
  • lifesaver, requestTimeout wasn't work at all for me with flex 4. – Savid Apr 17 '13 at 05:53
  • You have to use `airglobal.swc` and it depends on the version of `airglobal.swc` if the idleTimout is present. Then it might help to define that class within your project: ` package flash.net { public dynamic class URLRequestDefaults { public static var useCache:Boolean; public static var idleTimeout:Number; } }` – bebbo Mar 23 '23 at 15:10
1

Though it seems to be assumed that requestTimeout doesn't work. It actually does... the 1st time.

After the 1st request, the requestTimeout is set in

HTTPService.channelSet.currentChannel.requestTimeout

If you have to change the timeout, you will want to do it there.

To see the specific offending code, see AbstractOperation.getDirectChannelSet(). Even for different instances of HTTPService, it pulls from:

private static var _directChannelSet:ChannelSet;

_directChannelSet is only instantiated once, and the requestTimeout on it is only set on creation, so even if you change the requestTimeout on HTTPService, it won't reflect in the request.

0

You can set the request time out of http service objects, this will do what it says on the tin, but if you want to know more here is a link for the language reference:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/http/HTTPService.html#requestTimeout

Here is an example of how it could look in your code snippet with a 120 second time out:

<s:HTTPService id="svcList" requestTimeout="120" url="http://localhost/index.php" method="GET" result="svcList_resultHandler(event)" fault="svcList_faultHandler(event)">
  <s:request xmlns="">
    <mod>module</mod>
    <op>operation</op>
  </s:request>
</s:HTTPService>

Also worth bearing in mind if you set this attribute to zero or less, the request will not time out at all (according to the language ref).

Jeremy
  • 3,418
  • 2
  • 32
  • 42
  • this `requestTimeout` property doesn't work as described in the live docs. I try it before and the result is the very same, no change at all. – gustyaquino Feb 06 '12 at 11:57
  • Apparently the time out attribute is browser specific, with Chrome, Firefox and IE all behaving differently. I haven't done a comparison test, but its worth a look, especially if you can pick a browser that works for you, (of course that's the dream right!). – Jeremy Feb 26 '12 at 18:43