async-wormhole icon indicating copy to clipboard operation
async-wormhole copied to clipboard

Using the backtrace-rs crate inside of a generator segfaults on Linux x64

Open bkolobara opened this issue 4 years ago • 2 comments

Having a split stack makes it really easy to break backtracing libraries. For now I have disabled the test on Linux.

Could be a bug inside of the backtrace crate. Default backtraces on rust panics work.

bkolobara avatar Apr 03 '21 10:04 bkolobara

Do you know when this error started popping up? I think I see this now when wasmer is raising a user trap :/

kaimast avatar May 04 '21 22:05 kaimast

@kaimast I'm not sure when it started popping up. I don't think it's even related to changes in async-wormhole.

For the sake of stability I think I will abandon the original goal of having cross-stack backtraces. There are so many subtle ways this can fail, depending on the OS, architecture and optimisation mode. It's also super tricky to debug.

A big issue here is the use of inline asm! in Rust. We don't control the surrounding Rust code the compiler will generate different DWARF directives around us. I'm constantly running into the issue that it either works in debug or release modes, but not in both because the generated directives don't play nicely with the hand written ones.

I just need to figure out how to stop the backtrace on a specific function in Windows. On DWARF systems this can be accomplished using .cfi_undefined rip. I wonder if there is an equivalent .seh_ alternative on Windows. I found this in the Julia compiler, but would like to avoid writing a custom exception handler.

We carry panics across the stacks with: https://github.com/lunatic-solutions/async-wormhole/blob/master/switcheroo/src/lib.rs#L101 so we should be fine there.

bkolobara avatar May 06 '21 14:05 bkolobara