20 Replies Latest reply on Aug 20, 2010 10:55 AM by chris.campbell

    HTTPService  and URLoader gives steam error in Air 2.0

    patelbrijeshn Level 1

      Hi,

       

      we have a HTTPService call to server url which returns data in xml format in response. The server call normally takes more than 2 mins to process..

       

      The service call returns with a fault (Error #2032: Stream Error).

       

      It worked fine in 1.5 but with release of 2.0 it started giving steram error even for HTTP calls. We changed our code to Air 2.0 and used

      URLRequestDefaults.idleTimeout = 1200000;

      to set all requests a default IdleTime out.

       

      But still this doesn't seem to work correctly. It returns fine some times but goes to Fault most of the times.

       

      This issue is kind of critical as it has made our app unusable.

       

      Any thoughts or ideas ?

       

      Regards,

      Brijesh

        • 1. Re: HTTPService  and URLoader gives steam error in Air 2.0
          patelbrijeshn Level 1

          anybody got a chance to look at this one ?

          • 2. Re: HTTPService  and URLoader gives steam error in Air 2.0
            chris.campbell Adobe Employee

            Hi Brijesh,

            Just wanted to let you know that I'm investigating this issue and either I or someone else on the AIR team will get back to you soon.

             

            Thanks,

            Chris

            • 3. Re: HTTPService  and URLoader gives steam error in Air 2.0
              patelbrijeshn Level 1

              Hi Chris,

               

              I did sme time monitring when it times out.. if the request takes more then 3 mins it gives the stream error.

               

              I more thing you would like to look at. With AIR 2.0, we have to use idleTimeout parameter mandatory else all requests taking beyond 30 secs are returning stream error.

              So if I am keeping my app on 1.5.x and running with 2.0 run time. its failing with all the requests above 30 secs.

               

              I have IE 7.

               

              Regards,

              Brijesh

              • 4. Re: HTTPService  and URLoader gives steam error in Air 2.0
                chris.campbell Adobe Employee

                Hi Brijesh,

                Is it possible for you to send me your project (or sample code that displays this behavior)?  I've asked around and our timeout behavior did change for 2.0.  In 1.5 it was 60 minutes (for some platforms) and in 2.0 we set it to a consistent 30 seconds across all platforms with the idleTimeout allowing you to extend beyond that.  We're concerned that you are receiving a stream error, we were expecting a timeout message instead.  We did not run across this problem in testing so getting sample code would be very helpful.

                 

                Thanks,

                Chris

                • 5. Re: HTTPService  and URLoader gives steam error in Air 2.0
                  patelbrijeshn Level 1

                  Hi Chris,

                   

                  I can't share the project as its a secured  application. Here's the code which I am using .. (I have replaced actual url with dummy)

                   

                  var myService:HTTPService  = new HTTPService();               
                  myService.url = "https://myserver.com/somerequest.framework?"
                  myService.resultFormat = "e4x";
                  myService.requestTimeout =1000000;
                  myService.method = "get";
                  var parameters:Object = new Object();
                  parameters["someparams"]="test";                   
                  myService.addEventListener(ResultEvent.RESULT,onMyServiceSucess);
                  myService.addEventListener(IOErrorEvent.IO_ERROR ,onMyServiceFailure)
                  myService.addEventListener(FaultEvent.FAULT, onMyServiceFailure);

                   

                  URLRequestDefaults.idleTimeout = 3600*1000;
                  myService.send(parameters);

                   

                  The url requested does some processing on the webserver, and that processing at times takes beyond 3 mins. around 4-5 mins at times.

                  Without the idleTimeout parameter it times out at 30 seconds.  There's no issue with server's ssl certificate as well. Coz it works for requests that are very small and are on https.

                   

                  below is the error messgae from the fault event:

                   

                   

                  body = ""

                    clientId = "DirectHTTPChannel0"

                    correlationId = "7372C281-545C-9757-9E01-6052BD5EF8F1"

                    destination = ""

                    extendedData = (null)

                    faultCode = "Server.Error.Request"

                  faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032" errorID=2032]. URL:

                  faultString = "HTTP request error"

                    headers = (Object)#1

                      DSStatusCode = 0

                    messageId = "E872BCD0-6607-D721-ABCE-6055CAC7A283"

                    rootCause = (flash.events::IOErrorEvent)#2

                      bubbles = false

                      cancelable = false

                      currentTarget = (flash.net::URLLoader)#3

                        bytesLoaded = 0

                        bytesTotal = 0

                        data = ""

                        dataFormat = "text"

                      errorID = 2032

                      eventPhase = 2

                      target = (flash.net::URLLoader)#3

                      text = "Error #2032"

                      type = "ioError"

                    timestamp = 0

                    timeToLive = 0

                   

                  Note:

                  I have tried both with http and https. , same error

                  I have tried with and without the requestTimeout parameter of the httpService, same error

                  I have also tried by adding a sleep in the java on server to simulate the longer processing time on server., same error

                  I have tried with both "GET" and "POST" , same error

                  I have tried same calls using URLLoader (URLRequest) as well.. same error.

                  I have tried playing with timeout and keepalive of IE's internal settings in registry, still same error.

                   

                  It might be something to do with IE ?

                   

                   

                  I have one concern though.. AIR 2.0 mandates timeouts to 30 secs.. which is a great risk for existing 1.5 apps to break, if the users upgrade to 2.0.

                  It should not have been mandatory timeout at 30 secs..  It now forces all such apps to migrate to 2.0 namespace

                   

                  let me know if you need anything else, I am ready to help on this.

                   

                  Regards,

                  Brijesh

                   

                  Message was edited by: patelbrijeshn

                   

                  Message was edited by: patelbrijeshn

                  • 6. Re: HTTPService  and URLoader gives steam error in Air 2.0
                    chris.campbell Adobe Employee

                    Hi Brijesh,

                     

                    Thanks for the additional information.  I'm going to work on this today and will get back to you with an update shortly.

                     

                    Chris

                    • 7. Re: HTTPService  and URLoader gives steam error in Air 2.0
                      chris.campbell Adobe Employee

                      Hi Brijesh,

                      I did a few tests this afternoon and wanted to report back with my findings. I tried these tests on OS X 10.6, Win 7, and Win XP with IE 7.  I focused mainly on IE 7 since that was the browser you reported you were using.  All OS's had the AIR 2.0.2 runtime installed.

                       

                      I used your sample code and had a simple server side script that I could pass a delay parameter too.  I set the server's delay to 5 minutes.  Here's the php code:

                       

                      <?php
                      
                      $delay = 0;
                      if ( isset($_GET["delay"]) )
                      {
                        $delay = intval($_GET["delay"]);
                      }
                      
                      if ( $delay > 0 )
                      {
                        sleep($delay);
                        echo "Delayed " . $delay . " sec";
                      }
                      else
                      {
                        echo "Usage: " . $_SERVER['PHP_SELF'] . "?delay=n in sec<br>";
                      }
                      
                      ?>
                      

                       

                      My first test was to build the AIR app with the namespace set to 1.5, comment out the idleTimeout line, and use Flex SDK 4.0 with the AIR 1.5.3 SDK.  Once built, I tested the app with XP (again, using the AIR 2.0.2 runtime) and the app did not timeout at 30 seconds.  Instead it completed successfully after 5 minutes.

                       

                      Next I changed the app's namespace to 2.0, left the idleTimeout line commented out, and built using Flex SDK 4.0 with AIR 2.0.2 SDK.  My test on XP did timeout after 30 seconds (which is expected behavior.  See the note below.)

                       

                      Finally, I modified the code one last time by uncommenting the idleTimeout line and rebuilt.  The app ran and successfully completed at the 5 minute mark.  I tried this a few times with the same results.

                       

                      While I have been unsuccessful reproducing your error at the 3 - 5 minute mark, I do think we can safely say that building an app with AIR 1.5 and running it on a 2.0 runtime should not break any older behavior (30 minute timeout). 

                       

                      I found a great post by Chris Thilgen on the now defunk AIR 2 Beta forum that gives background on the history of the idleTimeout parameter for others interested:

                       

                      Believe it or not...yes...the version of IE can affect how AIR works. AIR takes advantage of the Windows networking/HTTP stack to accomplish many of its internal functions. And every version of IE updates/modifies the Windows internal networking/HTTP stack in (sometimes subtley) different ways.

                       

                      The issue that you are seeing is a change that was made between IE 6 and IE7-8. In IE6 the timeouts for many operations were either unbounded - or so long that it would normally not matter. In IE7-8 things got a little more strict and the timeouts can start kicking in.

                       

                      Your best option here is to make use of the new URLRequest.idleTimeout property introduced in AIR 2 to ensure that your requests are given enough time to complete.

                       

                      The following is some information I prepared to a similar response earlier in the beta program.

                       

                      Please let me know if it gets you rolling again.

                       

                      Thanks,

                       

                      Chris Thilgen

                      AIR Engineering

                       

                      -------------------------------------------------------------------------------

                       

                      We have made a change in the AIR 2 Runtime which affects the network timeout value - and this behavior varies depending on the value of your application's namespace and the platform on which you are running your application.

                       

                      -------------------------------------------------------------------------------
                      Windows

                       

                      1.5.1 content     60 mins (legacy)
                      1.5.2 content     60 mins (legacy)
                      1.5.3 content     60 mins (legacy)
                      2.0   content     PLATFORM_DEFAULT or value specified by URLRequest.idleTimeout
                      -------------------------------------------------------------------------------
                                        PLATFORM_DEFAULT = 30 SECS on Windows XP with IE 6.x
                                                           varies based on what version of IE
                                                           is installed

                      -------------------------------------------------------------------------------
                      Mac

                       

                      1.5.1 content     PLATFORM_DEFAULT (legacy)
                      1.5.2 content     60 mins (legacy)
                      1.5.3 content     60 mins (legacy)
                      2.0   content     PLATFORM_DEFAULT or value specified by URLRequest.idleTimeout
                      -------------------------------------------------------------------------------
                                        PLATFORM_DEFAULT = 60 SECS on Mac OS Leopard

                      -------------------------------------------------------------------------------
                      Linux

                       

                      1.5.1 content     30 secs (legacy)
                      1.5.2 content     30 secs (legacy)
                      1.5.3 content     30 secs (legacy)
                      2.0   content     PLATFORM_DEFAULT or value specified by URLRequest.idleTimeout
                      -------------------------------------------------------------------------------
                                        PLATFORM_DEFAULT = 30 SECS

                      -------------------------------------------------------------------------------

                       

                      So if you are going to bump your application up to the 2.0 namespace, you should also begin explicitly setting the idleTimeout property on your requests to ensure that they remain open long enough to service your application's needs.

                       

                      NOTE 1: Instead of setting the idleTimeout property on every URLRequest, you can modify the URLRequestDefaults.idleTimeout property which will modify the default idleTimeout value for URLRequests created after this property is modified.

                       

                      NOTE 2: The requestTimeout attribute in the mx:HTTPService tag is a little misleading as it does not actually affect the low-level networking stack. The requestTimeout attribute value only affects the Flex classes which are waaaaay above the networking protocols in the Flash Runtime.

                       

                      NOTE 3: You should be able to modify the idleTimeout behavior of the mx:HTTPService object by modifying URLRequestDefaults.idleTimeout property. We have logged a bug with the Flex SDK team to address hooking up the mx:HTTPService requestTimeout attribute with the underlying URLRequest.idleTimeout in a future release (https://bugs.adobe.com/jira/browse/SDK-22016).

                       

                      Chris

                      • 8. Re: HTTPService  and URLoader gives steam error in Air 2.0
                        VilleFluide Level 1

                        Hi everybody,

                         

                        We have a similar problem, but on RemoteObject. I've posted this into bugs forum, but still get no answer. Someone has a clue ?

                         

                         

                        After tests under AIR 2.0beta2, it doesn't change anything, still 30 seconds limit that cannot be extend on timeouts.

                         

                        Two questions : Do we need to switch to AIR2 Candidate Release ? (we were unable to rebuild our project correctly on Air2 RC, other bug maybe).

                        Is following code is correct ?

                         

                        var service:RemoteObject = new RemoteObject("myDestination");

                         

                        var operation:Operation = new Operation();

                         

                        operation.name = "myRemoteFunction";

                         

                        service.operations = new Object();

                         

                        service.operations[operation.name] = operation; // this fixes operation.service

                         

                        operation.service.requestTimeout = -1;

                         

                        URLRequestDefaults.idleTimeout=REQUESTS_TIME_OUT_IN_SECONDS*1000;

                         

                        var token:AsyncToken = operation.send();

                         

                        With this we still have 30seconds time out, event if REQUESTS_TIME_OUT_IN_SECONDS is set to higher values.

                         

                        setting positive value higher than 30 seconds in operation.service.requestTimeout has no effect.

                         

                        Thanks for help.

                        • 9. Re: HTTPService  and URLoader gives steam error in Air 2.0
                          dliberman Level 1

                          We have upgraded to air 2 runtime and framework.

                          Air Service call (Remote Object) most of the time takes more than 45 seconds to return from service call and we are getting error:

                          [RPC Fault faultString="error" faultCode="Channel.Call.Failed" faultDetail="NetConnection.Call.Failed: HTTP: Failed"]

                           

                          We are setting requestTimeOut for service tag to high number, but it seems not affecting it.

                          We tried to set UrlRequestDefaults.idleTimeOut property to high number as well as this posting suggests, but it seems not helping.

                           

                          We did verified that service sides completes work succesfully, but we still getting that error.

                           

                          Is there a workaround for the problem?

                           

                          Please advice.

                          • 10. Re: HTTPService  and URLoader gives steam error in Air 2.0
                            chris.campbell Adobe Employee

                            I'm going to look into the RemoteObject timeout issue.  Do you have a sample application (and server) that I can verify this with?  Please feel free to PM or email me at ccampbel@adobe.com.

                             

                            Thanks,

                            Chris

                            • 11. Re: HTTPService  and URLoader gives steam error in Air 2.0
                              chris.campbell Adobe Employee

                              I did more research on the RemoteObject issue and we suspect that this is a Flex SDK issue.  It might present itself in AIR because Flex is using a networking class on the inside of the RemoteObject that they are managing the timeout for.  I would like to suggest that you either add a new bug in Jira or add on on to the bug "Ensure that requestTimeout properties on any relavent messaging classes set URLRequest.idleTimeout (AIR only)" previously reported.

                               

                              Thanks,

                              Chris

                              • 12. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                patelbrijeshn Level 1

                                Hi Chris,

                                 

                                Thanks for testing it out.. sorry for late reply was stuck with some stuffs..

                                 

                                for 1.5 based app we were using Flex 3.2 sdk and AIR 1.5.0  (not 1.5.3).

                                we then migrated to using AIR 2.0 sdk with Flex 3.2.0

                                 

                                that might be causing some issues ?

                                 

                                Also, one question, did you try your script ....over the internet or within intranet ?

                                 

                                Regards,

                                Brijesh

                                • 13. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                  VilleFluide Level 1

                                  Hi Chris,

                                   

                                  thanks looking at this quite blocking issue for all RemoteObject & AIR developers. You suggest to post me another bug, or to file it in SDK-22016. But we have already posted it in https://bugs.adobe.com/jira/browse/SDK-15403, which in fact seems more appropriate reading bug title description.

                                   

                                  Regarding posting you a sample, I did it in that thread with the client side, but our server side is Java EJB 3 + Granite DS environment and would be not useful to post you a piece of code. To reproduce it is fairly simple, just have a server - side service that takes more than 30 seconds, and call it with my piece of code above, from an AIR Native application (debug or release mode). This will timeout after 30 seconds, and return the  [RPC Fault faultString="error" faultCode="Channel.Call.Failed" faultDetail="NetConnection.Call.Failed: HTTP: Failed"]

                                   

                                  Cédric,

                                  • 14. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                    joenewton25

                                    I have added a bug at http://bugs.adobe.com/jira/browse/FP-4934.  It is listed as a Flash Player bug because it is actually an AIR player bug but there is no category specifically for AIR.

                                    • 15. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                      chris.campbell Adobe Employee

                                      Brijesh

                                      As you noted, my tests were done with Flex 4.0 but our automation builds that test this feature out use Flex 3.2 and they also pass.

                                       

                                      I initially tested this with our intranet, but I just did another test using a server outside our firewall.

                                       

                                      Have you been able to reproduce the problem using the simple delay.php?

                                       

                                      Chris

                                       

                                      patelbrijeshn wrote:

                                       

                                      Hi Chris,

                                       

                                      Thanks for testing it out.. sorry for late reply was stuck with some stuffs..

                                       

                                      for 1.5 based app we were using Flex 3.2 sdk and AIR 1.5.0  (not 1.5.3).

                                      we then migrated to using AIR 2.0 sdk with Flex 3.2.0

                                       

                                      that might be causing some issues ?

                                       

                                      Also, one question, did you try your script ....over the internet or within intranet ?

                                       

                                      Regards,

                                      Brijesh

                                      • 16. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                        chris.campbell Adobe Employee

                                        Hi Cédric

                                        Thanks for commenting on SDK-15403.  Since that bug has been marked Closed/Fixed it might be best to vote/comment on SDK-22016 and FP-4934.

                                         

                                         

                                        Chris

                                         

                                        VilleFluide wrote:

                                         

                                        Hi Chris,

                                         

                                        thanks looking at this quite blocking issue for all RemoteObject & AIR developers. You suggest to post me another bug, or to file it in SDK-22016. But we have already posted it in https://bugs.adobe.com/jira/browse/SDK-15403, which in fact seems more appropriate reading bug title description.

                                         

                                        Regarding posting you a sample, I did it in that thread with the client side, but our server side is Java EJB 3 + Granite DS environment and would be not useful to post you a piece of code. To reproduce it is fairly simple, just have a server - side service that takes more than 30 seconds, and call it with my piece of code above, from an AIR Native application (debug or release mode). This will timeout after 30 seconds, and return the  [RPC Fault faultString="error" faultCode="Channel.Call.Failed" faultDetail="NetConnection.Call.Failed: HTTP: Failed"]

                                         

                                        Cédric,

                                        • 17. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                          chris.campbell Adobe Employee

                                          Hi Joe

                                          Thanks for opening up a new bug.  I made a comment also referring to SDK-22016 and voted.

                                           

                                          joenewton25 wrote:

                                           

                                          I have added a bug at http://bugs.adobe.com/jira/browse/FP-4934.  It is listed as a Flash Player bug because it is actually an AIR player bug but there is no category specifically for AIR.

                                          • 19. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                            thilgen Level 4

                                             

                                            There was a change introduced to the networking sub-system in AIR 2 which will cause RemoteObjects (which make use of NetConnection for their communication) to have a shorter idleTimeout on Windows when using the AIR 2.0 namespace (usually around 30 seconds but varies depending on which version of msinet.dll is installed).

                                             

                                            We are working on a resolution for this issue to be included in the next release of the AIR Runtime.

                                             

                                            Please refer to the following item in the Flex public bugbase for additional information:

                                             

                                            https://bugs.adobe.com/jira/browse/SDK-22016

                                             

                                            At this time, the only known workaround for RemoteObjects is to publish your AIR application with a namespace less than 2.0.

                                             

                                            Chris Thilgen

                                            AIR Engineering

                                            • 20. Re: HTTPService  and URLoader gives steam error in Air 2.0
                                              chris.campbell Adobe Employee

                                              Moved thread to the Adobe AIR Development forum