[Tip] Fix AS3-Flex Error #2032 Stream Error

Recently I encountered an error #2032 within a two year project in Flex, for three days I struggled with it and tried almost everything, this is why I’m posting this here so that it might save someone else time.

This error occurred when I tried to do an HTTPService call to the Back-End and send some really heavy file. The file would require Back-End parsing and when that was over it would return a result. However mid-way the POST call would be interupted and I was presented with a #2032 Stream Error fault.

The solution was both simple and extremely hidden and in my opinion stupid. In the HTTPService I had set the property:

this.requestTimeout = 3800;

However as shown in this post: http://stackoverflow.com/questions/8820715/flex-httpservice-times-out-anyway

This property is NOT taken into consideration by the HTTPService.

It needs:

import flash.net.URLRequestDefaults;
URLRequestDefaults.idleTimeout = 1200000; // or any amount of time in ms

This way we override the default timeout of EVERY call and thus the request no longer fails…

I truly hope this helps someone as the above post helped me.

Tagged , , , , , , . Bookmark the permalink.

13 Responses to [Tip] Fix AS3-Flex Error #2032 Stream Error

  1. DL says:

    Michael, was this a Flex web app project? I’m having the same problem, but it looks like flash.net.URLRequestDefaults is for AIR projects only. In fact, the flash.net package I have in a .swc does not even have the URLRequestDefaults class. I’m wondering if there’s a non-AIR workaround.

  2. No this was an Air project. This error is quite common and can occur for a number of reasons. You can find many solutions on the net, I just documented one that wasn’t anywhere else. From my experience I would say that this type of error is mostly related to the termination of a connection between a client and a server, the reason however will probably vary.

  3. Jina says:

    Miachael, I have both air and flash client and I am having same issue in air client. Do I need to set URLRequestDefaults.idleTimeout in a certain class in air package or any class is fine?

  4. I would suggest adding it in the same class that the url request is happening, or in the root file of the project. But in general any class is fine as long as it gets called/imported before the url request procedure.

  5. Jina says:

    Michael, thanks for your response. I have both air and flash clients and this is issue with air only. Both air and flash clients share most of the code and the URLLoader is created inside sharing code.
    I have following packages in my client and the URLLoader is happening in lib-core package which is not specific to air client and I couldn’t set the time out there. It looks like that I need to split the code but splitting code is lasting I want to do.

    lib-core(common package for both air and flash)

  6. You can place it in the main.mxml file of the air application after loading/importing all the other classes.

  7. Jina says:

    Michael, sorry keep bugging you. I came from JSP, HTML background and starting deal with actions script just recently because of my new job. I see main.mxml in flash application, but it doesn’t exist in air-app. Can I create a dummy one to set timeout?

  8. The air-app should also have a main.mxml (could be named differently) or share the one with the flash-app in that case you could create a simple class for just importing and setting the default-value
    and then adding this class to whatever file looks like its the core of the air-app, just make sure to include it last and call it.
    var dummyClass = new DummyClass();

    I hope it helps.

  9. Jina says:

    Michael, thank you very much for your response. It is very helpful and I was able to set the time out correctly. Many sites mentioned about setting the time out, but didn’t specify how. So, for the beginner, those sites weren’t much helpful. I really appreciate for your help.

  10. Vincent says:

    We also had some troubles getting timeouts working properly.
    We actually have multiple services with different configurable timeouts.

    Instead of setting the timeout we create a channelSet for the http service:

    private var loginChannelSet:ChannelSet = new ChannelSet();

    var loginChannel:Channel = new DirectHTTPChannel(“login”, “”);
    loginChannel.requestTimeout = clientConfig.loginTimeout;

  11. Vincent says:

    It removed the HTTPService declaration:

    here without brackets:

    mx:HTTPService id=”loginService”
    url=”login” method=”POST”
    useProxy=”false” resultFormat=”e4x”

  12. The New Mr says:

    I got this 2032 error because I was missing the extra swf files needed (such as framework_4.6.0.23201.swf etc).

    I noticed this by using chrome dev tools and getting a 404 error.

Leave a Reply

Your email address will not be published. Required fields are marked *