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.

Question State of supporting Multithreading for WebGL builds?

Discussion in 'Web' started by nfynt-zap, Feb 6, 2023.

  1. nfynt-zap


    Jun 3, 2021
    I am familiar that this age old topic has been supported as an experimental feature since 2019 LTS. And it's quite hit and miss to even build your project with its support on Unity version 2021.x LTS or before, I got build errors with 2019.4.27f1 & 2021.3.2f1.

    Anyways now that I am on 2022.2.4f1, the build issues along with few emscripten and JS related fixes seems to have been put in place. So, now I can build the wasm test project and host via a modified http.server python server providing the necessary COOP and COEP, CORS. But, now stuck at runtime exceptions in worker.js, regarding which I don't have much clue at the moment. Thought would check to see if anyone else is using this feature or got any ideas here.

    Please find few screenshots in the attachment and WebGL build linked as zip here. In brief, I've got following errors:
    Code (JavaScript):
    1. mt.worker.js:65 RuntimeError: null function or function signature mismatch
    2.     at AGCThread::Run() (mt.wasm:0x2ddf9b3)
    3.     at AGCThread::RunThread(void*) (mt.wasm:0x2ddf79a)
    4.     at Thread::RunThreadWrapper(void*) (mt.wasm:0x2ee8dc0)
    5.     at dynCall_ii (mt.wasm:0x2f23430)
    6.     at mt.framework.js:1686:20
    7.     at mt.framework.js:2205:21
    8.     at Object.invokeEntryPoint (mt.framework.js:2206:3)
    9.     at self.onmessage (mt.worker.js:144:48)
    Code (JavaScript):
    1. Pthread 0x01b850f8 sent an error! http://localhost:8000/Build/mt.worker.js:197: Uncaught RuntimeError: null function or function signature mismatch
    2. printErr @ mt.loader.js:82
    3. worker.onerror @ mt.framework.js:2143
    Some project settings related changes are:
    PlayerSettings.WebGL.emscriptenArgs = "-s ALLOW_MEMORY_GROWTH=1 -s PTHREAD_POOL_SIZE=8 -s PTHREAD_POOL_SIZE_STRICT=0";
    PlayerSettings.WebGL.threadsSupport = true;


    Attached Files:

  2. CodeSmile


    Apr 10, 2014
  3. pravusjif


    Jul 24, 2012
    Hello there, I'm having that exact same issue with the `null function or function signature mismatch` error in `worker.js` @nfynt-zap have you been able to identify what's causing it?
  4. nfynt-zap


    Jun 3, 2021
    Yes, it was due to a missing translation for `SceneManager.LoadScene` on the JS side, as mentioned in forum thread here.

    And here's the bug report stating it to be fixed in 2022.3.6f1,
    Haven't tested the fix, but do post here if it works.