Remote agent WebGL builds failing

I recently just upgraded to Unity Editor v2020.1.0f1 and ever since then my Azure pipeline’s remote WebGL builds have been failing when they get to the step of:
Failed running “C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe” -E “C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc” @“D:\a\1\s\Assets..\Temp\emcc_arguments.resp”

Usually there is a helpful stderr message, but this error only prints the command + args that failed to run.
stderr:ERROR:root:‘C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_FastComp_Win\binaryen\bin\asm2wasm D:\a\1\s\Temp\StagingArea\Data\linkresult_wasm\build.temp.asm.js --total-memory=33554432 --trap-mode=allow -O3 --mem-init=D:\a\1\s\Temp\StagingArea\Data\linkresult_wasm\build.js.mem --mem-base=1024 --wasm-only --symbolmap=D:\a\1\s\Temp\StagingArea\Data\linkresult_wasm\build.js.symbols -o D:\a\1\s\Temp\StagingArea\Data\linkresult_wasm\build.wasm’ failed

I am using a custom build script to build local addressables prior to starting the WebGL build. I’ve attached both the build logs and the custom build script.

Any insight is appreciated!

6222966–684384–6_Unity Build WebGL.txt (331 KB)
6222966–684390–AzureBuild.cs (3.71 KB)

1 Like

Did you ever figure out why things were failing? My team is encountering a very similar problem, but using 2019.4 in the azure devops pipeline. Other unity build targets work fine (UWP/Standalone/Android) but webgl fails, and with an almost identical error message.

The only webgl platform specific call we make has to do with stopping webgl from capturing all input on the page
(WebGLInput.captureAllKeyboardInput = false).

We never heard anything from Unity, but we were able to get consistent WebGL builds by using an Azure self-hosted agent. https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops

Has been working consistently for weeks now after switching over to using this agent. Hope it all goes well for you.

After experimenting more with the issue my conclusions are :

  1. There is no link between any API calls (WebGLInput.captureAllKeyboardInput = false) and this bug.

  2. This issue is caused by the process asm2wasm crashing. My strongest guess is that the machine runs out of ram.
    Developer Community
    Reading on the forums it looks like the build machine has 7gb of ram with 1.2 being used by the os.
    this does not leave much for the build since locally, asm2wasm takes up to ~5.5gb, so adding unity.exe on top of it we are blowing the available ram.

We have moved our builds to a self hosted agent as well.

Running out of RAM is possible. If it is a multicore agent, setting a global environment variable EMCC_CORES=1 may help alleviate the RAM usage.

When our next toolchain update lands, it will take away the whole asm2wasm.exe conversion process, so that should reduce memory usage at that step (and also speed up compilation)