Stream: git-wasmtime

Topic: wasmtime / PR #3932 Support disabling backtraces at compi...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 15 2022 at 21:56):

alexcrichton opened PR #3932 from no-backtraces to main:

This commit adds support to Wasmtime to disable, at compile time, the
gathering of backtraces on traps. The wasmtime crate now sports a
wasm-backtrace feature which, when disabled, will mean that backtraces
are never collected at compile time nor are unwinding tables inserted
into compiled objects.

The motivation for this commit stems from the fact that generating a
backtrace is quite a slow operation. Currently backtrace generation is
done with libunwind and _Unwind_Backtrace typically found in glibc or
other system libraries. When thousands of modules are loaded into the
same process though this means that the initial backtrace can take
nearly half a second and all subsequent backtraces can take upwards of
hundreds of milliseconds. Relative to all other operations in Wasmtime
this is extremely expensive at this time. In the future we'd like to
implement a more performant backtrace scheme but such an implementation
would require coordination with Cranelift and is a big chunk of work
that may take some time, so in the meantime if embedders don't need a
backtrace they can still use this option to disable backtraces at
compile time and avoid the performance pitfalls of collecting
backtraces.

In general I tried to originally make this a runtime configuration
option but ended up opting for a compile-time option because Trap::new
otherwise has no arguments and always captures a backtrace. By making
this a compile-time option it was possible to configure, statically, the
behavior of Trap::new. Additionally I also tried to minimize the
amount of #[cfg] necessary by largely only having it at the producer
and consumer sites.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Mar 15 2022 at 22:00):

alexcrichton updated PR #3932 from no-backtraces to main.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 16 2022 at 03:08):

pchickey submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 16 2022 at 14:24):

alexcrichton merged PR #3932.


Last updated: Dec 23 2024 at 12:05 UTC