-
Notifications
You must be signed in to change notification settings - Fork 321
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
Panics should not unwind into non-Rust code #534
Comments
@bnoordhuis @piscisaureus @ry WDYT? |
+1 |
Yes I think so too. Tho I think this should probably be dealt with at the rusty v8 layer... |
I'll move this to rusty_v8. The analysis that unwinding can't cross over into C++ or JS stack frames is correct, I'm just not sure how to handle that except abort. I don't think it's always possible to tell V8 to unwind until we're back in Rust territory again. |
It doesn't seem that the docs have been updated yet but Rust will always convert a panic into an abort in |
I just noticed and investigated something in the output in denoland/deno#7953 that I somehow missed the first time around, after the usual panic message:
A normal Rust panic does not SIGABRT. With the standard panic handler, first they print the panic message and backtrace, and then they try to unwind. That is where this panic aborts, because it happens inside a callback called by V8 and the unwinder gets confused by outer V8 stack frames. (In fact, it may be getting confused specifically by V8 JIT frames that don't show up in the gdb output.)
click for gdb backtrace (13 is C++ which calls 12 which is Rust)
As I understand it, we should try to prevent ever unwinding into non-Rust stack frames by making callbacks like this one use
catch_unwind
and then either manually exit or convert the error into something that can be sensibly passed up into V8, whatever is most appropriate in each case. This should be done wherever Rust code is called from non-Rust code in Deno and its dependencies.Quoting the
catch_unwind
docs:The text was updated successfully, but these errors were encountered: