Search Issue Tracker
Fixed in 2021.1
Planned for 2019.4, 2020.2
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.
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
- Shadows are not cast when you first Blit the Shadow map and then set it back to Buffer
- Changes to instanced detail mesh material don't immediately apply
- [uGUI] Vertices retrieved from GetUIVertexStream method cannot be modified when adjusting them through script
- Scroll bar scrolls less in the Package Manager packages than elsewhere when pressing on the empty scroll bar area to scroll
- Undo.RegisterCreatedObjectUndo dirties the scene, but no actual changes to Scene are made
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.