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

WebGL app cause Chrome crash (Unity 5.2.0f3)

Discussion in 'WebGL' started by auycro.heroz, Sep 10, 2015.

  1. auycro.heroz

    auycro.heroz

    Joined:
    Apr 1, 2015
    Posts:
    13
    I build game and try to run on chrome (Version 45.0.2454.85 m).
    Chrome was crash after finish downloading and parsing js files.

    I checked the Chrome crash log but there's no logs!!

    Anybody have any clue or known issue about this problem?

    I can play in Unity Editor(Unity 5.2.0f3).
    And, this game can be built and play with Unity 5.1.3f1 version.
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    That's probably Chrome running out of memory while parsing the js. You could compare the size of the js between the two versions of Unity. Maybe 5.2.0f3 generates a bigger js. Is that Chrome 32bit ?

    You can check whether Stripping is enabled and exceptions are disabled.
     
  3. yantrab

    yantrab

    Joined:
    Feb 12, 2015
    Posts:
    1
    Marco! it is not "out of memory" problem.(chrome warns of it)

    It is crash for me too.
    In my app, there is 3 texture friends face.
    If i connect to Facebook after loading game, all is fine,
    but if i already Facebook connected , the chrome crash after loading ended.

    My Facebook sdk version: 7.0.2

    I will be pleased if you tell me, why loading take so long.


    Edit: It's probably also a problem of memory, it works after enlarged the memory...:)
     
    Last edited: Sep 11, 2015
  4. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    936
    I am working on 5.2.0f3 and chrome crash if I reload the page.
    First opening all works fine.

    Any idea?

    Grazie!
    Stefano
     
  5. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Any error in the browser console ? (try in Development mode)
    Are you able to reproduce it with an empty project ?
     
  6. tom_zhang

    tom_zhang

    Joined:
    Apr 16, 2015
    Posts:
    1
    Happened to Me too.
    This problem happened before when I used unity 5.2.0f1(beta), and now still exist.
    I used 5.2.0f3 to build an empty project and a project just include a login to facebook(with facebook unity sdk 7.0.2), both of them worked very well.

    Crash only happen when I build my old project.
    And when I use "Build & Run", it runs much better(only reload will pop a error).
    But when I put the package to a server, and open with chrome, the chrome crashes.
    By the way, when open the server url with mac & chrome, it work much better(can run, just seems not so stable, and windows & firefox also can run with not a stable status, only windows & chrome crash)
     
  7. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    451
    I'm having what appears to be the same trouble here and thought I'd toss in my 2c. My WebGL build was working fine in Unity 5.1, but now crashes in Chrome building with 5.2. I've changed nothing other than upgrading from one version of Unity to the other. (Still works fine in Unity Web Player, but that's beating a dead horse at this point.)

    It crashes without showing any specific information in the browser console. I've also noticed that the time it takes to crash varies a bit... Sometimes the game will load and run for 10 seconds or so before it crashes, other times it crashes before it finishes loading the first scene. No player interaction is required either, it just sits there for a few seconds, then dies and takes the entire browsing session with it.

    I'm experimenting with doubling the allowed memory now, and will also try it with exceptions set to None and stripping turned off to see if I have any further luck. I'll let ya know if anything good comes of it :)
     
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Does Firefox crash as well ?

    Anyone who can submit a repro case and post the bug# here ?
     
  9. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    451
    Hi Marco,

    I just reverted things back to where I'd had them (the above changes did nothing for me) and tried it again in both Firefox and Chrome. The WebGL build seems to work fine in Firefox, but still giving the "Google Chrome has stopped working" crash in Chrome without giving any details as to why in the browser console, or elsewhere for that matter. At least we've seemingly narrowed it down to Chrome, although for all I know Win10 is hosing something I'm not catching on to, haha.

    I'll try running a small project and see if I have the same issues. My current project's a bit cumbersome to be submitting with a bug report & has a lot of backend ties. Testing a clean project may help me narrow it down a bit further & give me something cleaner to submit if I do have the same issues. Whatever happens, I'll update and let ya know where things stand, along with a bug report number if I get to that point.

    Thanks!
    - Ken

    Update: Also tested and working fine in MS Edge, for what that's worth. No luck as yet reproducing the issue in a smaller project. I'll keep tinkering.

    Update the 2nd: I also noticed that the game still seems to be running fine even during the crash event. What's happening is, the game loads and sits a few seconds (at best), then another window pops open with an Error window in front of it telling me that "Chrome has stopped working". If I close that window successfully before the original window behind it closes as well, I can see the game itself continuing on unaware of the impending browser crash. I'm not sure if this additional information helps any, but I thought I'd pass it along as well in case it were relevant.

    For reference, I'm using Unity 5.2.0f3 Personal, Chrome 45.0.2454.85 m, and Windows 10 to create a Facebook Canvas game (SDK 7.0.2b) with GameSparks as a backend. If you're interested in any WebGL settings on the project, I'm happy to share those as well. In the meantime, I'm off to try first clearing all data from Chrome, and then uninstalling & reinstalling it to see if that has any effect.
     
    Last edited: Sep 14, 2015
  10. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    451
    Curiouser and curiouser... I'm not sure it'll help anyone else experiencing issues, but I completely cleared out my Chrome cache/cookies/etc/etc/etc and everything seemed to be working as expected again. "Hurray, I'm back on track at last," or so I thought...

    I tried refreshing the page to make sure it wasn't just a fluke, and lo and behold, the browser crashed again. *sigh* I cleared Chrome out squeaky clean again, reloaded the game, and it worked again. So, of course, I tried reloading the game one more time, and as expected, watched it crash again.

    I've tried it several times this way, and it always plays correctly if everything in Chrome has been wiped, and always crashes if the game has been played previously to being wiped out. Again, I'm not sure if this helps, but I thought it bore mentioning. I should also note that I've only had the chance to try it from one copy of Chrome, on a single computer. I'll be testing it from a couple of other machines this evening & will post another update if I find any other peculiarities or possible solutions.
     
    Last edited: Sep 14, 2015
  11. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Actually, that's interesting. I wonder if that's related to IndexedDB. Do you use PlayerPrefs ? (which AFAIK should work in Chrome)
     
  12. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Same issues here: what works fine in Firefox crashes in Chrome. And in one instance Chrome doesn't crash but memory just explodes (from 800 to 3gb+ in 2 seconds after which it crashes. Memory use stays on max 800mb in firefox.)

    Sorry: haven't got a good repro project that I can easily submit
     
    krougeau likes this.
  13. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    451
    I am not using PlayerPrefs in my current project. All data is being stored on GameSparks.

    I did some further testing on a couple of different machines with similar results. The game will run fine if Chrome's data has been flushed, but crashes otherwise. I also kept an eye on system resources while running these tests and saw some odd behavior. If the game is being run for the first time after clearing out Chrome's stored data, the game tops out at using about 1Gb of memory while loading and then falls back to a comfortable 145Mb. If the game is being run without having cleared out Chrome's stored data, it uses upwards of 3Gb of RAM and then crashes (I've got 10Gb to work with on this machine and 4Gb on the two others I've tested with).

    I'm not sure what other mad science to try performing, but if there's anything you can think of for me to test, I'd be happy to give it a whirl. I hope the information is at least somewhat helpful. I'm not sure what you'd get out of it, but if you're interested in examining the game itself, I'd be happy to add you to the FB beta tester's list so you can check it out. Send me a PM for the details, if you'd like.

    Thanks for all of your hard work on these various WebGL issues, Marco. It's most certainly very much appreciated!
     
  14. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    that's definitely an odd behavior. random question: does your game uses asset bundles ?
     
  15. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    451
    I've been considering making use of them, but haven't as yet, no.
    One of these days perhaps I'll learn to NOT update software just because I can, hahaha. Seems to always create new problems :p
     
  16. auycro.heroz

    auycro.heroz

    Joined:
    Apr 1, 2015
    Posts:
    13
    Thank you, Marco.

    Yes, it seems to be Chrome running out of memory.
    I saw Chrome consume memory more than 3GB!!! And then crash.
    (I changed WebGL memory to 512. It can run for a while and then crash.)

    As you mentioned about the file size, there are no different that much i think.
    Unity 5.1.3f3: 28823 kb for *.js / 43427 kb for *.data
    Unity 5.2.0f3: 28171 kb for *.js / 43744 kb for *.data
     
  17. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    yuliyF and krougeau like this.
  18. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    936
    @Marco Trivellato
    Ciao Marco,
    sorry for the late answer but I was trying to build a scenario reproducible out of my project.
    I found the problem and is related to uGUI canvas and is generated by Vectrosity library (a long story short: we use vectrosity with "screen space camera" instead of "screen space overlay" and this generate the problem).
    Removing it all works fine, I will try to further go in deep.
    Bye,
    Stefano
     
  19. techs21

    techs21

    Joined:
    Aug 18, 2015
    Posts:
    59
    my build crashes in chrome but works fine in firefox
     
  20. vandalgames

    vandalgames

    Joined:
    Dec 4, 2014
    Posts:
    5
    I confirm that even with the latest 5.2.0p1.
    As Krougeau said, I am crashing too with a new chrome window open then got a pop up telling: "Chrome has stopped working". This bug weirdly gone when you go to factory reset and reset your chrome, but the problem reappear again after few time. My project use AssetBundle and also WWW to grab texture from web. Not sure if it linked with the problem but it is worth to mention.
     
    Last edited: Sep 21, 2015
  21. vandalgames

    vandalgames

    Joined:
    Dec 4, 2014
    Posts:
    5
    I confirmed that i can reproduce that crash every time with this script

    using UnityEngine;
    using System.Collections;

    public class DownloadButton : MonoBehaviour {
    public void DownloadCube(){
    StartCoroutine (DownloadCubeRoutine());
    }
    IEnumerator DownloadCubeRoutine(){
    WWW www = WWW.LoadFromCacheOrDownload ("http://192.168.0.2/bundles/WebGLPlayer/Cube.unity3d",0);
    yield return www;
    Instantiate (www.assetBundle.mainAsset, new Vector3 (Random.Range(-15,15), Random.Range(-15,15), 0), Quaternion.identity);
    www.assetBundle.Unload (false);
    }
    }


    After clicking a couple of time on the Button, wait few seconds... then crash. Chrome opened a new browser with error.


    Update :
    Happens only on chrome and with 2 on 5 computers here. All computers has same Chrome version which is 45.0.2454.99 m

    Update:
    When running Chrome with incognito mode, no crash. Look like it is something related with Caching?
     
    Last edited: Sep 22, 2015
  22. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Have you submitted a bug report yet ? If so, could you please post the bug # here so I can take a look at it ?

    thanks!
    Marco
     
  23. vandalgames

    vandalgames

    Joined:
    Dec 4, 2014
    Posts:
    5
    I just sent a bug report from the Editor. Not sure how to provide this bug #.

    Thanks
     
  24. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Thanks. The bug id will be in the confirmation email that you should receive within a few hours.
     
  25. vandalgames

    vandalgames

    Joined:
    Dec 4, 2014
    Posts:
    5
  26. Kobutapapa

    Kobutapapa

    Joined:
    Feb 25, 2015
    Posts:
    7
    We are experiencing a similar problem with WebGL in Google Chrome (Aw, Snap as the game loads). It began at the time of the 45.0.2454.93 release (the same time the number of Chrome/WebGL posts increased on this forum) and persists with 45.0.2454.99 (Firefox and Safari are working as expected) so we're working on the assumption that something has changed in Chrome.
     
  27. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I thought that Google Chrome doesn't support WebGL. I have the latest Chrome on my Mac and when I try to load a WebGL page, Chrome tells me: "You need a browser which supports WebGL to run this content. Try installing Firefox."
     
  28. maliceCO

    maliceCO

    Joined:
    Jun 26, 2014
    Posts:
    4
    We have the same problem, when running Chrome with incognito mode, no crash. we use chrome Version 45.0.2454.101 m and build from Unity 5.2.0 f3.

    In firefox and Edge run fine.
     
  29. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    There seem to be a few different posts about issues which may or may not be the same in this thread. Anyways, for anyone seeing Chrome run out of memory (showing an error, or just "Oh, Snap" right after startup), see this thread, for a potential fix coming up in Chrome (and please let us know the results).
     
  30. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    could you please try to replace:

    Code (csharp):
    1. WWW www = WWW.LoadFromCacheOrDownload(...)
    with

    Code (csharp):
    1. WWW www = new WWW(...)
    ?
     
  31. Deleted User

    Deleted User

    Guest

    We're also getting a crash on the latest version of Chrome. About 5 seconds after the app is finished loading. Built using Unity 5.2.1f1. Only affecting Chrome on some PC's but all work fine in Incognito mode. None of our js files include LoadFromCacheOrDownload
     
  32. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    do you have a (ideally small) project we could look at ? If so please submit a bug report and quote the bug# here.
     
  33. Deleted User

    Deleted User

    Guest

    I'm trying to create one but so far no luck.
     
  34. auycro.heroz

    auycro.heroz

    Joined:
    Apr 1, 2015
    Posts:
    13
    Last edited: Oct 19, 2015
  35. Deleted User

    Deleted User

    Guest

    We found where the problem is on our end. Our WebGL build was running on a nodejs server. When we ran the same build on the same browser on an IIS server or Apache server it worked fine without crashing. Not sure why that would cause an issue or why the issue would be fixed by running in Incognito mode but, thats what we found anyway.
     
  36. techs21

    techs21

    Joined:
    Aug 18, 2015
    Posts:
    59
    my game crashes only on some goole chrome other people that try to load it works fine
    So i am not sure why it crashes on one chrome but not the other

    also when it crashes it is opening another tab in my browser

    it works in everything but google chrome
     
    Last edited: Jan 3, 2016
  37. xTheTimeSte

    xTheTimeSte

    Joined:
    Apr 4, 2021
    Posts:
    5
    the problem

    the webgl build runs fine on every desktop browser and firefox mobile, but crashes after 3 seconds when using chrome mobile or safari mobile with the "aw, snap" page.

    the problem was the amount of RAM that the project was using for loading assets.
    i found that the main problem was loading the audio system.

    when the game started the RAM usage quickly escalated from 300 MB to 1,3GB.

    how i fixed


    i had a background music 20 minutes long, i cut that to 5 minutes.
    click the music, then click override for webgl
    set the load type to Streaming
    set the quality to 1

    with this workaround the RAM usage floats around 600 MB, this allows the build to run on mobile.

    upload_2022-5-9_18-18-9.png