Replies: 5 comments 11 replies
-
@sbc100 not sure what inside mywasm code, the assert happened here: stream/emscripten/system/lib/libc/dynlink.c,250,_emscripten_thread_sync_code
#ifdef _REENTRANT
void _emscripten_thread_sync_code() {
// This function is called from emscripten_yeild which itself is called
// whenever we block on a futex. We need to check to avoid infinite
// recursion when taking the lock below.
static thread_local bool syncing = false;
if (syncing) {
return;
}
syncing = true;
ensure_init();
if (thread_local_tail == tail) {
#ifdef DYLINK_DEBUG
fprintf(stderr, "%p: emscripten_thread_sync_code: already in sync\n", pthread_self());
#endif
goto done;
}
pthread_rwlock_rdlock(&lock);
if (!thread_local_tail) {
thread_local_tail = head;
}
while (thread_local_tail->next) {
struct dso* p = thread_local_tail->next;
#ifdef DYLINK_DEBUG
fprintf(stderr, "%p: emscripten_thread_sync_code: %s mem_addr=%p mem_size=%d table_addr=%p table_size=%d\n", pthread_self(), p->name, p->mem_addr, p->mem_size, p->table_addr, p->table_size);
#endif
void* success = _dlopen_js(p);
if (!success) {
fprintf(stderr, "dlerror: %s\n", dlerror());
}
assert(success);
thread_local_tail = p;
} |
Beta Was this translation helpful? Give feedback.
-
actually I do make it worked before. But now just need to cross origin to load the wasm into the worker and this issues happened. |
Beta Was this translation helpful? Give feedback.
-
I found that:
seems will callback to JS and try to load the SO file, I am not sure why? |
Beta Was this translation helpful? Give feedback.
-
Recently, I found that the file be embed into wasm file with --embed-file and map to MEMFS like "/myfile.so", it can be found by FS in the mainthread. But it cannot be found by the worker thread. |
Beta Was this translation helpful? Give feedback.
-
Q1: in mymodule.wasm, it will do dlopen("mylib.so"),
do I need to use :
emscripten_async_wget to download the mylib.so firstly?
Also I tried to debug into the mymodule.js, seems the __dlopen_js will fallback to download the so file, but seems there is no chance to put the url on the mylib.so.
the url now only the filename: mylib.so, how to make the url like: https://mysite.com/wasm/mylib.so.
Q2. how to preload the so files as this link: https://emscripten.org/docs/porting/files/packaging_files.html#preloading-files
Beta Was this translation helpful? Give feedback.
All reactions