Open
Description
Calls to wasmfs_create_opfs_backend() seem to not return on certain low end devices, or only return once every x reloads.
Tested on a dell 3100 chromebook (2 core machine)
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.71 (4171ae200b77a6c266b0e1ebb507d61d1ade3501)
clang version 20.0.0git (https:/github.com/llvm/llvm-project d6344c1cd0d099f8d99ee320f33fc9254dbe8288)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/lib/emsdk/upstream/bin
Compiling with emcc Emscripten.c -o index.html -s WASM=1 -s USE_PTHREADS=1 -sWASMFS -sPTHREAD_POOL_SIZE=2
#include <assert.h>
#include <emscripten/console.h>
#include <emscripten/proxying.h>
#include <emscripten/threading.h>
#include <emscripten/wasmfs.h>
#include <pthread.h>
#include <stdio.h>
int mount_opfs() {
emscripten_console_log("mount_opfs: starting");
backend_t opfs = wasmfs_create_opfs_backend();
emscripten_console_log("mount_opfs: created opfs backend");
int ret = wasmfs_create_directory("/libsdl", 0777, opfs);
emscripten_console_log("mount_opfs: mounted opfs");
return ret;
}
void *thread_main(void *arg) {
emscripten_console_log("trying to mount\n");
mount_opfs();
emscripten_console_log("finished mount\n");
}
int main() {
int arg = 42;
pthread_t thread;
if (pthread_create(&thread, NULL, thread_main, &arg) != 0) {
perror("pthread_create failed");
return 1;
}
emscripten_console_log("Main thread continues\n");
/* pthread_join(thread, NULL); */
emscripten_console_log("Main thread done\n");
return 0;
}
On my development PC, the log reaches finished mount
, but on a lower end device it only hits mount_opfs: starting
. The main thread continues however.
From my understanding it's spawning the proxy worker that fails, but I'm not sure how I would fix or work around this
Metadata
Metadata
Assignees
Labels
No labels