Capture a backtrace before calling wasm (#830)
* Capture a backtrace before calling wasm This helps mitigate the issue, at least locally, described in #829 and there's some more comments inline in the code as well. * Run rustfmt * Move around where the trace happens
This commit is contained in:
committed by
Dan Gohman
parent
c417d4b587
commit
0c99ac3d7e
@@ -61,6 +61,17 @@ pub extern "C" fn wasmtime_init_eager() {
|
||||
state.tried = true;
|
||||
assert!(!state.success);
|
||||
|
||||
// This is a really weird and unfortunate function call. For all the gory
|
||||
// details see #829, but the tl;dr; is that in a trap handler we have 2
|
||||
// pages of stack space on Linux, and calling into libunwind which triggers
|
||||
// the dynamic loader blows the stack.
|
||||
//
|
||||
// This is a dumb hack to work around this system-specific issue by
|
||||
// capturing a backtrace once in the lifetime of a process to ensure that
|
||||
// when we capture a backtrace in the trap handler all caches are primed,
|
||||
// aka the dynamic loader has resolved all the relevant symbols.
|
||||
drop(backtrace::Backtrace::new_unresolved());
|
||||
|
||||
if unsafe { EnsureEagerSignalHandlers() == 0 } {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user