Search Issue Tracker
Fixed in 2021.1.X
Fixed in 2019.4.X, 2020.2.X
Votes
6
Found in
2019.1.10
Issue ID
1174367
Regression
No
[WebGL] Build crashes if metadata is too large
WebGL build fails to start with the following error messages:
exception thrown: abort({}) at jsStackTrace@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:942:12
stackTrace@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:956:11
onAbort@http://localhost/htdocs/Build/UnityLoader.js:1139:50
abort@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:29036:10
___syscall192@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:8582:67
___mmap@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e line 1379 > WebAssembly.instantiate:wasm-function[177106]:0x31a401b
__ZN6il2cpp2os16MemoryMappedFile4ViewEPNS0_10FileHandleEPxxNS0_22MemoryMappedFileAccessES4_PNS0_21MemoryMappedFileErrorE [il2cpp::os::MemoryMappedFile::View(il2cpp::os::FileHandle*, long long*, long long, il2cpp::os::MemoryMappedFileAccess, long long*, il2cpp::os::MemoryMappedFileError*)]@blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e line 1379 > WebAssembly.instantiate:wasm-function[174667]:0x314c36a
...
TypeError: "attempting to access detached ArrayBuffer"
mmap blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:4914
mmap blob:http://localhost/067d1180-5ec5-445e-81dd-59c458c82b5e:6692
...
The problem is in the system libraries of the Emscripten compiler that is used to target WebAssembly. A fix to the compiler has been posted and landed at https://github.com/emscripten-core/emscripten/pull/9012 .
The fix will eventually find its way to an upcoming Unity release when we update the Emscripten compiler to a new version, but there is, unfortunately, no release ETA for that, since compiler change affects all components of Unity, and needs a complete testing process.
If you want, you can locally patch your Emscripten compiler to carry the fix, by changing the two lines as shown by diff https://github.com/emscripten-core/emscripten/pull/9012/commits/89a380770902eb1221874765a11023e24133ca52 in file library_memfs.js inside Unity installation tree.
Another workaround can be to use a Unity editor script to assign "PlayerSettings.WebGL.memorySize = 256;" or similar so that the deployed build has a large enough heap at startup to avoid the issue.
Comments (3)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash on BurstCompilerService::CompileAsync when entering Play mode in a specific scene
- InvalidOperationException when using Game Camera Preview in Scene window with a custom RenderGraph pass
- Changing "PreWarm" parameters on VFX Graph leads to significant performance drops and freeze due to rapid changes in "Total Time"
- Player display resolution changes to the native resolution of the monitor when Player becomes unresponsive
- [Quest] Game View is no longer rendered in the HMD if it's hidden in the Editor when using Meta Link
robertirribarren
Apr 17, 2020 01:08
Had this issue on 2019.3 release version as well.
Twyker_gp
Feb 04, 2020 16:55
Had this issue on 2019.3 release version. Only replacing the code as mention above did the trick.