Skip navigation
Currently Being Moderated

A script in this movie is causing Adobe Flash Player to run slowly.

Sep 19, 2012 8:38 AM

I'm using Windows XP

Flash player 11,3,300,257

 

“A script in this movie is causing Adobe Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?”

 

public function getMembersCount(channel:String=''):*{

          if(typeof netGroups[channel]=='undefined') {

                    return;

          }

          return netGroups[channel].netGroup.estimatedMemberCount;

}

 

Launching this code from js every 3 seconds via setInterval via ExternalInterface. After 80 intervals it drops this popup window with that message, blocking every flash application in all Google Chrome tabs, even youtube stops playing!

 

Interesting, calling this function doesn't  trigger popup even after 179 times:

 

public function helloworld(str:String=''):*{

     return 'Hello world!';

}

 

So the problem is in NetGroup itself or ExternalInterface?

 

How to avoid this popup?

 

 

It seems there is some threshold check somewhere. Popup appears after exactly 46th iteration, if i'm stopping iterations manualy after 45 iteration this popup isn't displayed.

 

If i'm stopping iterations after 45 iteration even for 10 minutes and then resuming it's throwing this popup window right away.

 

Tools for debugging this will be welcome.

 
Replies
  • Currently Being Moderated
    Sep 19, 2012 9:44 AM   in reply to Somebbb

    Built-in debugger should be ok, Flash Builder debugger would be better. Something is feeding data into 'netGroups'. The fact that a 'get' function on an objects property is causing that is very unlikely.

     

    What exactly is netGroups a parsed data structure of (how large is this NetGroup) and is whatever is populating and updating it (unless the default) interfacing with other services whether it be over TCP, UDP, HTTP->Script (esp database), etc?

     

    Are you listening for all netStatus events from the NetGroup?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2012 1:00 PM   in reply to Somebbb

    You're halting Flash from continuing to process frames. Infinite loops or recursion, network connect timeouts and trying to execute excessive amounts of code on a single frame will bring up the dialog. There is a setting in Flash Pro publish settings for this dialog (File->Publish Settings->Flash (.swf) Settings->Script time limit (15 seconds by default).

     

    If a network connection is attempted (especially on windows) that fails and a timeout exceeds 15 seconds the script may halt. I've hit this walls tons if I attempt to use sockets and don't set the timeout much higher.

     

    In your situation I would absolutely validate a response returned from flash and never request information again until I get a valid response. Flash may delay sending a result or you're not validating it and your loop just continues to mercilessly ask Flash for information but Flash won't respond and then, there's your dialog.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 20, 2012 6:21 AM   in reply to Somebbb

    It's all about validation. I'm not extremely familiar with the NetUser class but most network libs come with a timeout property on any connection or query. Networks are notorious for locking things up, they require timeouts. It's always standard practice to make a request and then handle all possible contingencies. If you get a good result, continue, if not, handle the part of the problem that went wrong based on the information you have on hand. If you handle it and it continues to fail, warn the user there is a network issue and to either reconnect or try again later.

     

    Pretend I'm asking you. Do you think I should ever do something infinitely that never validates? Could anything go wrong?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 7:24 AM   in reply to Somebbb

    I have sent enormous amounts of data via ExternalInterface and never had an issue. Although I always base64 encode my data and wrap it in a format like JSON before sending. There may be a character that's causing the response to fail that encoding and wrapping may solve. ExternalInterface either goes over ActiveX or (from Adobe docs) uses this API:

     

    http://www.mozilla.org/projects/plugins/npruntime.html

     

    That API itself may have a limit but the ExternalInterface documentation doesn't specify any limits. It also states any ActionScript types are converted automatically. Perhaps it's having an issue converting a type that isn't a base ActionScript or JavaScript type. Again, encoding and wrapping the objects up in JSON would solve an issue like that.

     

    As for testing limits, you can write a quick test app that sends info to JS via ExternalInterface, continually appending more and more data (I'd do it in large chunks) until you see it fail. It should be pretty quick and easy to find any limits like that. I still think your issue is unrelated to size more than it's related to translation of a character or type in transmission back to JS.

     

    You can also do some basic stuff like watch the memory footprint of your browser while the app runs. If you continually allocate more and more ram then you should see how you're disposing unneeded objects. JS may be allocating to the point your browser simply stops it from functioning properly due to mass allocation. I see no immediate options in say Firefox's Advanced Javascript Options though so I think memory usage is fairly liberal. If it becomes a problem you can find a more efficient binary data type to use as well which compresses data down (the purpose of AMF for instance). LocalConnection has around a 100kb limit if I remember correctly so a limit somewhere in your path is possible.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 9:41 AM   in reply to Somebbb

    If it walks like a duck, sounds like a duck and looks like a duck, it's probably a duck.

     

    If you test transmitting something else over ExternalInterface instead of the NetGroup object and it never fails, it's the NetGroup object. What part of it I'm not sure you'll ever know.

     

    I'd still advise converting it into a base64 encoded friendly wrapped JSON object and unwrapping it on the JS end. Those multibyte characters and accidental XML invalidators get me all the time (like auto-converting & to & invalidating XML markup rules). So I just convert everything.

     

    Because you're using such a fast interval (3 seconds), using a binary wrapper format could kill 2 birds with one stone. Reduce bandwidth and eliminate character issues. Action Message Format (AMF, http://en.wikipedia.org/wiki/Action_Message_Format ) might be ideal, native to AS3. You'll need a JavaScript AMF library too ( https://github.com/jamesward/JSAMF ).

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 9:56 AM   in reply to Somebbb

    JSON itself doesn't encode the strings though. If it's a character issue you'll need to encode those strings to base64 for safety. This is done a lot when transmitting byteArrays.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 11:07 AM   in reply to Somebbb

    Seems to be narrowing down nicely to a type or acccess issue. When you request the data does NetGroup query anything or is it returning information it already contains? I'm not familiar enough with it to know it that in-depth.

     

    If it's querying something then it could be waiting on that query, or failing it. The target of the query could also have an anti-hammer policy. If too many requests happen in a designated period some servers are configured to ignore the request or warn the user not to hammer the server.

     

    If the data is being populated by other services automatically and no queries are made then I'd suspect you are indeed having an issue converting a type.

     

    You can always go old school, make your own "type" (class) that contains the information you really need and populate it from the NetGroup object yourself, then send just that data. It's a lot of work but I don't know how mission critical it is. I expect eventually you'll add in a piece from the NG object and it all breaks again. Then you'll know what part wasn't working. Also with your own type you can put a little padding between you and the NG object for some better fallback validation and protection against these odd halts.

     

    Don't forget, AMF might solve it.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 11:16 AM   in reply to Somebbb

    I still say stick it in a ByteArray and let it convert it to AMF3, send it and see if it gives the error.

     

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/utils/ByteArray.html#writeObject%28%29

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2012 11:52 AM   in reply to Somebbb

    All queries over a network need to be roped in. You can never expect them to go right all the time, there's just too many factors.

     

    It may not cause the player to pop a dialog but you are leaving some queries running until a timeout hits which at a pace of "once per 3 seconds" can add up.

     

    If it's a failed network connection AMF3 won't solve that. You just always needed to validate the response, or that you even received one .

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2012 10:23 AM   in reply to Somebbb

    you have access to the underlying source code, take a peek.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 24, 2012 6:21 AM   in reply to Somebbb

    It's not something readily accessible but your playerglobal.swc is just a .zip file (as all .FLA / .SWC / .IPA / etc are). Unzip it and grab library.swf. If you decompile that SWF you will be able to look through the code. I'm not sure if it's frowned upon but I wouldn't see why, aside decompiling SWF for "the wrong reasons". I don't find this to be a wrong reason when it's necessary sometimes to understand something from the ground up.

     

    Do note, just like JavaScript minification, some AS3 may be obfuscated and difficult to follow. Some isn't. How difficult any specific library is to read is arbitrary. That would be how you can take a look however.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 26, 2012 6:10 AM   in reply to Somebbb

    You're welcome and I hope you find what you're looking for! The extra work tends to pay off.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points