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
  4. Dismiss Notice

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

Discussion in 'WebGL' started by stonstad, Oct 9, 2020.

  1. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    599
    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.

    Code (CSharp):
    1. Full Error:
    2. exception thrown: TypeError: Atomics.wake is not a function,TypeError: Atomics.wake is not a function
    3. at _emscripten_futex_wake (https://customerselectunitysvcs.blob.core.windows.net/bugreporting/bug01/Build/Build.framework.js.gz:8:228642)
    4. at https://customerselectunitysvcs.blob.core.windows.net/bugreporting/bug01/Build/Build.wasm.gz:wasm-function[26900]:0x6f33be
    5. 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
     
    TerraUnity likes this.
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    944
    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.
     
    TerraUnity likes this.
  3. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    599
    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?
     
  4. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    944
    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.
     
  5. d_grass

    d_grass

    Joined:
    Mar 6, 2018
    Posts:
    45
    @jukka_j

    Hi I also stumbled on this issue right now. Glad that here is already a thread :D.
    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?
     
  6. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    944
    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.
     
    d_grass likes this.
  7. d_grass

    d_grass

    Joined:
    Mar 6, 2018
    Posts:
    45
    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?
     
  8. unity_K_nDtRZtMCIVjg

    unity_K_nDtRZtMCIVjg

    Joined:
    Feb 4, 2021
    Posts:
    8
    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?
     
  9. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    233
    @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.