-
Notifications
You must be signed in to change notification settings - Fork 249
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
Backtracing after stack overflow does not work on macOS #356
Comments
Thanks for the report! Can you perhaps get a stack trace in a debugger for this? One common issue i've seen is that the sigaltstack is too small, so it may be a "double" stack overflow where the |
I tried to allocate a 1MB sigaltstack, but the error persists: let mut stack_space = vec![0u8; 1048576];
let new_stack = libc::stack_t {
ss_sp: stack_space.as_mut_ptr() as *mut _,
ss_flags: 0,
ss_size: 1048576,
};
assert_eq!(libc::sigaltstack(&new_stack, ptr::null_mut()), 0); I wasn't able to get a stack trace because the debugger can't resume execution from the signal handler after a |
Ah sorry but without the ability to reproduce or debug I'm not really sure what's going on here, I can't really help a whole lot :( |
More info: rust-lang/backtrace-rs#356 And related PR: rust-lang/backtrace-rs#357
Excerpting relevant comments from the PR that adds a test to demonstrate this:
—alexcrichton
—tmiasko
—alexcrichton I do not see a reason to close this issue but to be frank, it is the sort of enhancement request that is likely to be open for a long, long time. |
Ignoring apple's compact unwind info I did expect backtraces to work in the prologue even without asynchronous unwinding support. Asynchronous unwinding is only necessary when popping stack frames and running cleanup code for faults at arbitrary instructions. I very much expect backtrace generation to unconditionally work at arbitrary locations. Sampling profiles depend on this. |
Also I believe LLVM is going to stop emitting compact unwind info for rust code or any other code not using the C, C++ or Obj-C personality functions as there is a limit of 3 personality functions in the compact unwind info format and these personality functions take up all room when used in the same executable/dylib. |
I do think that we should try to improve the situation, FWIW, and I am aware incremental improvements may be sufficient for many use-cases. It just seems like fixing all this is a nontrivial haul. |
Can you confirm this and if so, open a new issue for that? |
If I understand correctly it got merged, then reverted because of a build error and a revert of the revert has been posted but not yet merged: rust-lang/rust#102754 (comment) |
I'm trying to get a backtrace from a SIGSEGV caused by stack overflow (hitting guard page). It seems that this is not working on macOS.
My reproduction case:
Output:
Rust version:
The text was updated successfully, but these errors were encountered: