Open imlihang opened 4 years ago
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.
@imlihang Did you figure this out? I just stumbled upon the same issue:
worker.js onmessage() captured an uncaught exception: NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://REDACTED.wasm.6a6ab926.js' failed to load.
Error: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://REDACTED.wasm.6a6ab926.js' failed to load.
at self.onmessage (data:application/javascript;base64,...==:1:1013)
Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://REDACTED/file.wasm.6a6ab926.js' failed to load.
at self.onmessage
I'm seeing what seems to be the same issue.
Chrome Version 120.0.6099.227 (Official Build) (64-bit)
Windows 10 22H2 Os Build 19045.3930
Emscripten emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.0 (3fd52e107187b8a169bb04a02b9f982c8a075205) clang version 14.0.0 (https://github.com/llvm/llvm-project 4348cd42c385e71b63e5da7e492172cff6a79d7b) Target: wasm32-unknown-emscripten Thread model: posix
Using EmSDK 3.0.0
Top Chrome errors
Refused to execute script from 'http://localhost:8000/GameEngine.js' because its MIME type ('text/plain') is not executable.
self.onmessage @ GameEngine.worker.js:1
worker.js onmessage() captured an uncaught exception: NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:8000/GameEngine.js' failed to load.
threadPrintErr @ GameEngine.worker.js:1
self.onmessage @ GameEngine.worker.js:1
GameEngine.worker.js:1 Error: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:8000/GameEngine.js' failed to load.
at self.onmessage (GameEngine.worker.js:1:1386)
Refused to execute script from 'http://localhost:8000/GameEngine.js' because its MIME type ('text/plain') is not executable.
self.onmessage @ GameEngine.worker.js:1
and a whole bunch of other crap. Under chrome dev tools in the "Network" tab each .js file has type "text/javascript". Smells like something gets gloriously messed up somewhere.
I confirm this behavior. I am also using Chrome on Windows.
I am using a manually built opencv.js runtime (emscripten 3.1.58).
Full repro code (I'm using WSL):
$ cd
$ cd emsdk
$ ./emsdk activate latest
$ source ./emsdk_env.sh
$ cd ..
$ git clone https://github.com/opencv/opencv.git
Now either try:
$ emcmake python3 ./opencv/platforms/js/build_js.py build_wasmthreads --build_wasm --threads
$ emcmake python3 ./opencv/platforms/js/build_js.py build_wasm --build_wasm
Then:
await cv;
. This line of code will fail when WASM threads are enabled, and the call is performed from a web worker.@andynewman10 what error message do you see in the pthread case?
Can you confirm if you get the same issue with emsdk install tot && emsdk activate tot
?
@sbc100 I am getting the same result with emsdk install tot && emsdk activate tot
.
The error I am getting is actually different :
Refused to execute script from 'http://localhost:56523/undefined' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I am not opening any page and doing anything special beyond spawning a web worker and calling importScripts in that worker, at the beginning, and only once.
The importScripts('http://localhost:56523/opencv.js')
statement in the web worker is successful (raises no exception).
The URL of the main page is http://localhost:56523/#/test and the URL of the worker is http://localhost:56523/worker.js.
The same code works fine from the main thread (opencv.js loaded through a script tag in this case).
@andynewman10 should we open a new issue for this? It seems unlikely this this is the same issue for back in 2020.
I assume this is a regression that that the same code worked fine with some older version of emscripten? I'm guessing that this is part of the fallout from #21701, since that was a major pthread change that landed in 3.1.58. Can you confirm that it works in 3.1.57?
@sbc100 I am happy to test with previous versions of emscripten.
Can I switch to a specific version using emsdk install XXX && emsdk activate XXX
?
It does not work with emscripten 3.1.57 either.
Followed your advice and opened #22117.
I'm using pthreads with -s TOTAL_MEMORY=671088640 -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD with EMSDK 2.0.6. I run my unit test in Chrome browser with version 86.0.4240.75. I got the following error message.
xxx.worker.js:1 Refused to execute script from 'xxx.js' because its MIME type ('text/plain') is not executable. worker.js onmessage() captured an uncaught exception: NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'xxx.js' failed to load. Error: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'xxx.js' failed to load. pthread sent an error! xxx.worker.js:1: Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at xxx.js failed to load. Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at xxx.js failed to load.
How can I solve this problem? Thank you.