Skip to content
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

Log backtrace on sigsegv and sigbus signals #22

Merged
merged 5 commits into from
Jun 12, 2023
Merged

Conversation

lionel-
Copy link
Contributor

@lionel- lionel- commented Jun 8, 2023

Requires posit-dev/positron#708 otherwise the backtrace doesn't show up.

Screenshot 2023-06-08 at 18 14 29

@lionel-
Copy link
Contributor Author

lionel- commented Jun 8, 2023

I guess I should notify the next handler. Rust handles segfaults to detect and report stack overflows: rust-lang/rust#31333

@lionel-
Copy link
Contributor Author

lionel- commented Jun 9, 2023

I guess I should notify the next handler. Rust handles segfaults to detect and report stack overflows

To do this robustly we need a separate implementation for Windows and Unix so this doesn't seem worth it. I added a note about that.

I also added a note about R's segfault handler. It doesn't override our handler because we set R_SignalHandlers to 0 before startup.

Copy link
Contributor

@jmcphers jmcphers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

// Register segfault handler to get a backtrace. Should be after
// initialising `log!`. Note that R will not override this handler
// because we set `R_SignalHandlers` to 0 before startup.
stdext::traps::register_trap_handlers();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to disable this in release builds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there be a downside to leave it on? On the upside it could be useful for R developers to get a backtrace of their native code on crash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right -- let's leave it on.

@lionel- lionel- merged commit fa816d2 into main Jun 12, 2023
@lionel- lionel- deleted the feature/sigsegv-backtrace branch June 12, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants