Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Too much recursion in Firefox

Discussion in 'WebGL' started by d12frosted, Apr 7, 2015.

  1. d12frosted

    d12frosted

    Joined:
    Feb 3, 2014
    Posts:
    43
    Hey, I am loading asset bundles with `WWW.LoadFromCacheOrDownload` method. And it works well in Safari, but fails on firefox with following error: "Too much recursion". Is it know thing?
     
  2. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Is Firefox throwing the error or is Unity? I've seen a similar issue in javascript (jQuery had a bug they had to fix) the essentially was resulting in a stack overflow.
     
  3. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Firefox throws the "Too much recursion". My game is in an iFrame.
    "exception thrown: InternalError: too much recursion,Pointer_stringify@http:/...g.js:1:14456.
    Chrome opens it with no problem at all.
     
  4. hyperhippo

    hyperhippo

    Joined:
    Jan 16, 2014
    Posts:
    37
    I have the same issue as Victor_Kallai, I'm working on a game to host on Kongregate.com and they need to put it into an iFrame so that they can have all their Ad Banners and Chat and comments and rating systems etc.
     
  5. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Looks like this is an asm.js / emscripten bug (most likely not Unity's doing). I've seen Firefox references to this bug popping up over the years, but more recently related to asm.js. Even UE4 is seeing this issue when building for HTML5. What Firefox versions are you running?
     
  6. hyperhippo

    hyperhippo

    Joined:
    Jan 16, 2014
    Posts:
    37
    i updated yesterday... 37.0
     
  7. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    553
    I think that maybe unity has a bug with downloading large files with "WWW" class.
    But I didn't check it to confirm the bug.
     
  8. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    I am running Firefox 37.0.1 and Chrome 41.0.2272.118 m. My javascript knowledge is low, but I suspect there is a problem (only in firefox) when the webgl div's parent is an iFrame. It crashes after the preloader fully loads (probably when it should extract the gzips).
    It might be from the different javascript engines the browsers run, but maybe a fix can be found for the fileloader.
    Thank you for the support.
     
  9. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    188
    And... it is bug still here:
    The error was: too much recursion in Firefox 38.0.5 and unity 5.10f
     
  10. d12frosted

    d12frosted

    Joined:
    Feb 3, 2014
    Posts:
    43
    I am experiencing this thing as well. Pretty often. Actually, there in an unhandled exception and firefox gone into 'too much recursion'. Try to build your game with 'Full' exceptions enabled. And check console for exceptions.
     
  11. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    188
  12. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    68
    That bug only fixed bad urls crashing. This is still a bug: Firefox nested in an iFrame, using WebGl in Facebook, crashes 100% downloading bundles. You can see it happen in this test link to our game: https://apps.facebook.com/bbh-oa-eap/?revision=1437496359&forceGL=1
    In firefox it will crash, in chrome it will load correctly.

    We've experimented with small bundles, and changing whats in the bundles - that does not seem to be a factor.
     
  13. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I noticed you filed a bug report, we will take a look at it.
     
  14. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Quick update on this issue: It looks like there is indeed a problem with WWW.LoadFromCacheOrDownload and iFrame's. On Firefox, this does not work properly resulting in a "too much recursion" error, or a silent failure.

    While we investigate this issue further, we recommend you to replace:

    WWW www = WWW.LoadFromCacheOrDownload(...)

    with:

    WWW www = new WWW(...)

    which seems to work fine.
     
  15. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    WWW www = new WWW(...) doesn't work fine for me. It produces the same error.
     
  16. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Maybe that's a different problem. Have you tried a non-Development build ? If that does not fix it, I would recommend you to submit a bug report with a sample project.
     
  17. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    Yes, it fails in 'non-development' builds. It's coming when trying to download an asset bundle (using new WWW or WWW.LoadFromCache doesn't make a difference.) Only fails when the game is running on Facebook. Works fine in Chrome.
     
  18. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    68
    We have this solution working in chrome and firefox, using 5.2.0b2.
    We did run into another problem though, Firefox only, that you might be seeing. Check your bundles location with a cert checker like https://www.sslshopper.com/ssl-checker.html
    Firefox is really anal about any small issues, whereas chrome is more forgiving. If firefox deems any www call to not be up to snuff with its cert, you will also get the too much recursion bug.
     
  19. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    Our game is currently live and running well in the webplayer, so it probably isn't a security issue.

    I will try and make a small repro project to see if we can narrow down the cause.
     
  20. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    451
    I'm currently developing a WebGL game for Facebook and am also encountering the Too Much Recursion error in Firefox. Unfortunately, the Javascript console isn't showing much in the way of useful information, so I'm not entirely sure just what the issue is.

    Oddly enough, the game runs just fine in Chrome, but then it throws a nasty snarl of errors when I try to leave the game by pressing Facebook's "Home" button or any other link. I see no errors in Chrome's console at this point, other than a warning about "Synchronous XMLHttpRequest" being deprecated, and that's coming from one of Facebook's own scripts, not my code.



    The game itself is rather small (19mb WebGL, 11mb Web Player), makes no use of Asset Bundles, and I'm only using the Compressed folder rather than the Release folder, which I did not upload (though I've tried using it as well). I'm using a WebGL compatible beta Facebook SDK for Unity (7.0.2 I believe) and the latest GameSparks SDK Unity as well. I should also note that I'm using Unity 5.1.2f1 (personal edition).

    I've included the screenshot of the Firefox and Chrome errors / info above in hopes that someone might be able to enlighten me as to what I might do to solve these issues. If I can provide any additional information about the build, please let me know.

    PS: Out of morbid curiosity, I used the SSL Checker link above to make sure everything on my site was up to snuff, and it passed with full marks.

    Update: I've been able to implement a hybrid deployment so that Chrome users are served the WebGL version of the game and all other browsers receive the Web Player, which seems like a viable short-term solution. I'm still awfully curious as to why I see errors in Chrome only when trying to move away from the game, so if you've any thoughts on the matter, I'd love to hear them.

    Update, The Second: I have no idea what changed, but I'm no longer receiving the Too Much Recursion errors in Firefox & the WebGL player now works there as well. I wish I knew for certain just what's changed, but I've been steadily working on the game under the assumption that Firefox & WebGL just weren't going to get along at all and only realized it was fixed after a spur of the moment test run... I am still receiving the "Uncaught abort" errors in both Chrome and Firefox, but I believe I've narrowed those down to an issue with Gamesparks. Essentially, a request is being sent to close the connection gracefully when the user navigates away from the page, but the request is then interrupted by said navigation before a proper response has come back. Hopefully I can get that all worked out in the near future, but it's irrelevant to the topic at hand.

    Best of luck, everyone!
     
    Last edited: Aug 11, 2015
  21. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
    I'm also getting the same error in a WebGL game that works fine on our own server, but borks in Firefox on a gaming portal who are hosting it (so probably related to the iframe). I'm not using asset bundles, and there's no use of WWW.LoadFromCacheOrDownload in the code. Built with 5.1.1p3. Will try with the latest Unity version.

    I get the "Too much recursion" popup, and this in the console:

    "exception thrown: InternalError: too much recursion,Pointer_stringify@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:1:13841
    _stat@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:1:225253
    Kyd@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:18:658236
    kvd@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:18:593132
    oyd@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:18:651750
    LTc@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:22:229087
    LTc@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:22:229593
    LTc@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:22:229593
    LTc@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:22:229593
    LTc@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:22:229593
    LTc@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:22:229593
    LTc@http://twits-game.herokuapp.com/Release/twitswebgl_101615.js:22:229593
    LTc@http://twits-game.herokuapp.com"[…] index.html:34:6
    Module.printErr() index.html:34
    callMain() twitswebgl_101615.js:38
    doRun() twitswebgl_101615.js:38
    run/<()
     
  22. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    We're experiencing this issue as well.

    In 5.1.2p1 when deployed in Facebook (iFrame) we receive the "too much recursion" error in Firefox - works fine in Chrome. Tried a build in 5.2.0b5 and got the same error in Firefox.
     
  23. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
  24. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Do you get the same error with a Development build ?

    if you are not using iframes and LoadFromCacheOrDownload, I would be interested in seeing a bug report about this.
     
  25. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Would you be able to submit a bug report ?
     
  26. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
    Hi Marco,

    We ARE using iFrames (but not LoadFromCacheOrDownload). I'll try doing a development build and see what we get.
     
  27. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
    Hi again,

    Just tried with a development build, and yes I do get the same error (when viewed in an iframe).
    Are there any more points around use of iframes that I should be aware of?
     
  28. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
    So I think I've sorted this now. Turns out there was an analytics plugin (Parse) left in from the iOS version that was causing the problem. I guess that was trying to make www calls. Took it out and it's working fine now. Thanks for all the help!
     
  29. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    451
    Certainly, Marco. I'll submit a detailed report a bit later this afternoon. Thanks for responding!
     
  30. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    We are. I believe I tried a build without the LoadFromCacheOrDownload and it was unsuccessful as well but I will confirm.
     
  31. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Just confirmed that changing WWW.LoadFromCacheOrDownload to new WWW() fixed the 'too much recursion' error in Firefox (in iframe/Facebook). Although this isn't really a plausible solution since our application relies heavily on caching.

    Marco, is there a fix in the works for this issue?

    Thanks!
     
  32. levwsr

    levwsr

    Joined:
    Jul 23, 2012
    Posts:
    68
    My experience is that the WWW version will still cache. Keep in mind in WebGL its using the normal browser cache, not one managed by Unity, and the web browsers default behavior is to cache all files for you.

    If you experience something differently please say so. Our build is live now and the first load is definitely much longer than subsequent loads: https://apps.facebook.com/bbh-oa-eap
     
  33. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    This was my expectation but it didnt seem to be faster on subsequent loads. I need to take a deeper look at the browser cache and will report back if it isn't caching locally for some reason. Thanks!
     
  34. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    We are still looking on it. We will post an update here as soon as we have news.
     
  35. slmoloch

    slmoloch

    Joined:
    Feb 11, 2015
    Posts:
    5
    the same issue here. It looks like it somehow related to IndexedDB.
     
  36. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    That's right. It's related to a Firefox security and privacy measure in regards to IndexedDB and iframes.

    Anyway, we will make sure Unity WebGL still works when IndexedDB is not available. A fix will be available soon.
     
  37. sumansom

    sumansom

    Joined:
    Jun 4, 2015
    Posts:
    9
    I have a one game which using lots of Playerpref and its working fine on firefox with iFrame.But i have another project which giving me " too much recursion" issue.It seems Playerpref is not responsible for this issue.Please let me know why this issue should be come and how should i solve it.
     
  38. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Is your other project using WWW.LoadFromCacheOrDownload ? If yes, that is not currently supported in Firefox in iFrames. We will fix it to work gracefully, but it will still not cache (because Firefox does not allow that in iFrames). However, I recently talked to a Mozilla engineer who said that they plan to allow this in the future.
     
  39. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Jonas,

    Could you please provide a bit of clarification here?

    You're saying that Firefox will not cache assets in iFrames (i.e Facebook Canvas) in the current release (5.1.3) of Unity WebGL.

    I can confirm that I get an 'indexedDB is undefined error' in Firefox when testing my WebGL builds but it appears that assetbundles are properly retrieved from the cache when viewing the Network trace. Are they using a different cache storage in Firefox?

    I am using the standard WWW constructor to download assets (not WWW.LoadFromCacheOrDownload).

    Is there a discrepancy or am I misunderstanding?

    Thanks!
     
  40. McKrackeN

    McKrackeN

    Joined:
    Oct 28, 2009
    Posts:
    51
    Hi guys,

    We're having the same issue when trying to run the game from Kongregate compiled with Unity 5.2.0f2. We're not using WWW.LoadFromCacheOrDownload. Right after it finishes downloading the game, it crashes with "too much recursion".

    Any progress on this subject?

    Thanks!
     
  41. sumansom

    sumansom

    Joined:
    Jun 4, 2015
    Posts:
    9

    Hi Jonas

    We are not using WWW.LoadFromCacheOrDownload for downloading assets even working on Unity 5.1.We are using WWW www2 = new WWW (downloadurl) & in safari,chrome its working fine.

    When we can expect this issue will be resolve from your side ?
     
  42. sumansom

    sumansom

    Joined:
    Jun 4, 2015
    Posts:
    9

    Hi We are facing same issue with WWW (...).Please let us know what should we do ?
     
  43. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    if you are not using LoadFromCacheOrDownload and still experiencing this problem, please try to comment out the early return on
    !window.indexedDB in the output .js file:

    Code (csharp):
    1.  
    2.     var unityFileSystemInit = Module['unityFileSystemInit'] || function (){
    3.         window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
    4. //        if (!window.indexedDB)
    5. //            return;
    6.         FS.mkdir('/idbfs');
    7.         FS.mount(IDBFS, {}, '/idbfs');
    8.         Module.addRunDependency('JS_FileSystem_Mount');
    9.         FS.syncfs(true, function (err) {
    10.             Module.removeRunDependency('JS_FileSystem_Mount');
    11.         });
    12.     };
    13.  
     
    Last edited: Sep 7, 2015
    Zenix likes this.
  44. sumansom

    sumansom

    Joined:
    Jun 4, 2015
    Posts:
    9

    Hi

    I will try it.I have two more issue with firefox.

    1 Size of output.js file is too large around 34 mb.Please let me know what editor should i use to open this file.

    2 Getting "permission denied to access property "toString" in firefox.

    Please let me know how i can solve this.
     
  45. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    on Windows, I recommend EmEditor.

    is that at runtime ?
     
  46. sumansom

    sumansom

    Joined:
    Jun 4, 2015
    Posts:
    9
    Last edited: Sep 8, 2015
  47. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I understand it will take more time to load but for testing purposes it would be good to know whether that fixes the problem.

    does this only occur when the webgl build is inside an iframe ? Can you reproduce it locally ?
     
  48. sumansom

    sumansom

    Joined:
    Jun 4, 2015
    Posts:
    9
    If you are talking about facebook iframe then yes.If we are running build without facebook/iframe (HTML iframe not tried yet) its working fine.

    This is urgent product for us.Can we do conversation in email to fixed this issue ? If yes my email id is rishabh@creatiosoft.com
     
  49. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I suggest that you submit a bug report and we take it from there.
     
  50. sumansom

    sumansom

    Joined:
    Jun 4, 2015
    Posts:
    9
    Currently is there any way which we can use to solve "toString" issue for firefox with iframe which we are getting in facebook?
     
    Last edited: Sep 8, 2015