WebGL Player Broken, Chrome v86.0.4240.75 (Oct.'20), "Atomics.wake not a function."

Heads up —

Chrome (v86.0.4240.75 released 10/6/2020) is throwing a fatal error “exception thrown: TypeError: Atomics.wake is not a function,TypeError: Atomics.wake is not a function” on Unity WebGL players. This fatal error does not affect versions of Chrome earlier than 10/6/2020.

Full Error:
exception thrown: TypeError: Atomics.wake is not a function,TypeError: Atomics.wake is not a function
at _emscripten_futex_wake (https://customerselectunitysvcs.blob.core.windows.net/bugreporting/bug01/Build/Build.framework.js.gz:8:228642)
at https://customerselectunitysvcs.blob.core.windows.net/bugreporting/bug01/Build/Build.wasm.gz:wasm-function[26900]:0x6f33be
at _emscripten_current_thread_process_queued_calls

The error affects only the latest public release of Chrome. Older versions of Chrome and Edge are OK. This likely affects you if WASM threading is enabled (for async/await).

Repro
URL: https://customerselectunitysvcs.blob.core.windows.net/bugreporting/bug01/index.html
Unity Case 1283961

1 Like

Thanks, yeah, the function got renamed from Atomics.wake to Atomics.notify, but we are still on an older compiler version that does not have the rename. This can be hotfixed by finding library_pthread.js in the Unity subdirectories and renaming Atomics.wake there to Atomics.notify inside function emscripten_futex_wake.

1 Like

Thank you @jukka_j

For a production application we will need to switch behavior based on the version of Chrome. Does Unity have a hotfix which can work for both Chrome versions – current and prior to the 10/6 update?

I doubt you’ll need to support a version of Chrome that does not have Atomics.notify(). For a good while now Chrome and other browsers have had the function available under both names.

@jukka_j

Hi I also stumbled on this issue right now. Glad that here is already a thread :smile:.
I renamed it like you said under C:\Program Files\Unity\Hub\Editor\2019.4.8f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\library_pthread.js
and restarted Unity just in case but somehow it does not apply. Did I something wrong?

Try doing some silly/trivial change to a C# file after editing the .js file, and rebuild. Unity engine does not track changes to the .js files, so it might think that there is no need to rebuild the project at all, if only those files got changed.

1 Like

Thanks its working now. But isn’t the project recompiled if I build to target, thats what I think to know right now or am I wrong? This case shows me that its not apply or?

Hello Unity Team. This issue still exists in the latest Unity 2019.4 LTS. We can rename this function locally but what about Cloud Build? Is it broken?

@unity_K_nDtRZtMCIVjg Hi, I’ve raised the priority of getting this task backported to 2019.4 with the team. But in the meantime, you should be able to modify your WebGL template to use Atomics.notify with a script block or use a separate Javascript file, and Cloud Build would use these files for the build just as they’re used locally.