-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emscripten_dlopen fails on Safari #21571
Comments
Can you try load the module just one at a time to see if that makes the problem go away? i.e. can you wait for the result of one Also, can you share that full set of link flags that you are using? |
I'm currently using RTLD_NOW flag ony. But i think i tried to use all the possible combination of flags. Tomorrow will try to load modules one by one. But even if this would fix the Safari issue, i doubt i will accept this as a workaround solution... Btw seems like the same issue happens in windows Firefox as well. |
Sorry, I didn't mean to suggest that as the final solution, just as an aid to debugging the issue. i.e. is the root cause of the issue that async nature of the code loading and the interleaving of the async work?
|
How to properly wait in fetch API onsuccess callback? i tried blocked wait approach: , but looks like in this case it never exits from the loop. dlopen code looks like this:
|
Well, i commented emscripten_sleep in the loop, and now it works... But unfortunately this didn't fix the issue on Safari and Firefox. |
Probably i have to execute dlopen from main thread? |
Ok, i moved emscripten_dlopen to main thread and now the issue solved in Safari (both desktop and mobile) and Firefox! |
Ah, I should have asked initially if you were using threads. Can you share the full set of emcc link flags you are using? Can you describe more the sequence you follow in the broken case? e.g How are you using the fetch API and and thread API and dlopen API to trigger the issue? |
No, threads are disabled in this specific emscripten build. |
Can you explain what you mean by this? My understanding is that browsers are single threaded and that all callback happen on the same thread. |
Above i mentioned the loop, which i executed in fetch onsuccess callback:
I mentioned that the loop never exits. |
Anyway the issue was fully solved as soon as i moved emscripten_dlopen outside of the callback, and processed it in main app thread. |
Hello,
I recently implemented asynchronous dynamic modules support for my WASM project.
Loading is quite simple:
Since loading is asynchronous - there are usually several modules in the fly, depending on assets.
The system works fine in chrome, but doesn't work in Safari (both MacOS and iOS).
It reports unresolved exported symbols in side modules. But problem is the symbols aren't related to those modules at all. They are located in other side modules.
For example it throws error for DdsImporter.so module:
bad export type for '_ZTVN4Tmrw4Data16GltfImporterE": undefined.
This symbol is just virtual functions table of Gltfimporter class which is not part of DdsImporter at all, and DdsImporter is not using it.
GltfImporter class is instantiated in another side module.
Safari always mixes the modules randomly during resolving symbols. Always throwing different resolving issues for different modules. There is no determinism.
There is example url to check the issue:
http://honya.myftp.org:88/wrooms/index.html?native_debug=true
The text was updated successfully, but these errors were encountered: