You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is also some support code in JS in src/library_exceptions.js. I believe that and extras.c is all unneeded in the new wasm exceptions support @aheejin is working on, so I hope that will be properly threadsafe?
I have removed the most common place where an exception has been thrown and it significantly improved stability for the application. But I cannot replace all exceptions.
I would like to ask if there is a roadmap or a rough estimate when the new exception handling would be available? Thanks.
We are actively working on the new EH and it is being tested and stabilized, but I think it will need several more months before being reliable enough to be tried by normal users. That being said, you can try it now by using -fwasm-exceptions flag to emcc command line (You shouldn't use -s DISABLE_EXCEPTION_CATCHING=0 with it). But it is likely that there are many bugs remaining. And currently only V8 has an experimental support for this feature among the major web VMs.
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.
Activity
sbc100 commentedon May 23, 2020
I think its probably not thread safe today for the reason you point out.
I believe the globals in question are here:
emscripten/system/lib/compiler-rt/extras.c
Line 15 in 852ca4e
I think the solution is to make these variables into wasm globals rather than living in linear memory (similar to how we handle
__stack_pointer
).kripken commentedon May 23, 2020
There is also some support code in JS in
src/library_exceptions.js
. I believe that andextras.c
is all unneeded in the new wasm exceptions support @aheejin is working on, so I hope that will be properly threadsafe?aheejin commentedon May 24, 2020
Yes, the wasm EH will need neither of extras.c and JS exception libraries, and I can't think of a reason why it wouldn't be thread safe.
malytomas commentedon May 28, 2020
Thank you all for the information.
I have removed the most common place where an exception has been thrown and it significantly improved stability for the application. But I cannot replace all exceptions.
I would like to ask if there is a roadmap or a rough estimate when the new exception handling would be available? Thanks.
aheejin commentedon May 28, 2020
We are actively working on the new EH and it is being tested and stabilized, but I think it will need several more months before being reliable enough to be tried by normal users. That being said, you can try it now by using
-fwasm-exceptions
flag toemcc
command line (You shouldn't use-s DISABLE_EXCEPTION_CATCHING=0
with it). But it is likely that there are many bugs remaining. And currently only V8 has an experimental support for this feature among the major web VMs.sbc100 commentedon May 28, 2020
We can possible make the current emscripten exceptions thread safe if there is strong need for it before native exception handling lands.
In the mean time we should not allow builds to use exceptions and threads at the same time.. since these are not compatible today.
malytomas commentedon Jun 9, 2020
I personally would prefer the effort to be put into the new native exception handling.
Warning would have been nice, but completely failing builds is an overreaction, in my opinion.
kripken commentedon Aug 25, 2020
#11518 fixed most of this, but see the comment in the code there, there remains a corner case not fully handled.
stale commentedon Aug 28, 2021
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.
aheejin commentedon May 3, 2022
Wasm EH proposal hasn't been fully standardized yet, but it's been implemented in Emscripten and (I believe) Safari and FireFox too, and is thread safe: https://emscripten.org/docs/porting/exceptions.html#webassembly-exception-handling-proposal