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

feat: print a backtrace on SIGSEGV #6907

Merged
merged 3 commits into from
Mar 1, 2024
Merged

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Mar 1, 2024

Implementation from https://github.com/rust-lang/rust/blob/3dee9775a8c94e701a08f7b2df2c444f353d8699/compiler/rustc_driver_impl/src/signal_handler.rs

Example

error: reth interrupted by SIGSEGV, printing backtrace

target/debug/reth(+0x5458eeb)[0x5587ab60aeeb]
/usr/lib/libc.so.6(+0x40770)[0x7f63e39b2770]
target/debug/reth(+0x2c6b70e)[0x5587a8e1d70e]

### cycle encountered after 3 frames with period 4
target/debug/reth(+0x2c6b713)[0x5587a8e1d713]
target/debug/reth(+0x2c6b713)[0x5587a8e1d713]
target/debug/reth(+0x2c6b713)[0x5587a8e1d713]
target/debug/reth(+0x2c6b713)[0x5587a8e1d713]
### recursed 63 times

target/debug/reth(+0x2c6b713)[0x5587a8e1d713]

note: reth unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
note: we would appreciate a report at https://github.com/paradigmxyz/reth
[1]    2865088 segmentation fault (core dumped)  cargo r --bin reth

Whether symbols are available is up to libc to determine, see man backtrace_symbols_fd

@DaniPopes DaniPopes force-pushed the dani/stack-overflow-handler branch from 7f5c309 to fd66d06 Compare March 1, 2024 11:52
raw_errln!("");
written += rem.len() + 1;

let random_depth = || 8 * 16; // chosen by random diceroll (2d20)
Copy link
Collaborator

Choose a reason for hiding this comment

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

bruh

Copy link
Collaborator

@shekhirin shekhirin left a comment

Choose a reason for hiding this comment

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

LGTM, did you test it on release builds?

@DaniPopes
Copy link
Member Author

Just did

error: reth interrupted by SIGSEGV, printing backtrace

target/release/reth(+0x1dd5766)[0x558993e66766]
/usr/lib/libc.so.6(+0x40770)[0x7fa7a3b05770]
target/release/reth(+0x20273a2)[0x5589940b83a2]
target/release/reth(+0x20273c7)[0x5589940b83c7]
target/release/reth(+0x20273c7)[0x5589940b83c7]
target/release/reth(+0x20273c7)[0x5589940b83c7]
target/release/reth(+0x20273c7)[0x5589940b83c7]
target/release/reth(+0x20273c7)[0x5589940b83c7]
target/release/reth(+0x20273c7)[0x5589940b83c7]
target/release/reth(+0x20273c7)[0x5589940b83c7]
target/release/reth(+0x2027482)[0x5589940b8482]
target/release/reth(+0x2c20243)[0x558994cb1243]
target/release/reth(+0x2a02829)[0x558994a93829]
target/release/reth(+0x3514f8d)[0x5589955a5f8d]
target/release/reth(+0x2027635)[0x5589940b8635]
/usr/lib/libc.so.6(+0x29cd0)[0x7fa7a3aeecd0]
/usr/lib/libc.so.6(__libc_start_main+0x8a)[0x7fa7a3aeed8a]
target/release/reth(+0x1068025)[0x5589930f9025]

note: we would appreciate a report at https://github.com/paradigmxyz/reth
[1]    1804857 segmentation fault (core dumped)  cargo r --bin reth --release

@DaniPopes DaniPopes enabled auto-merge March 1, 2024 14:09
@DaniPopes DaniPopes added this pull request to the merge queue Mar 1, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 1, 2024
@shekhirin shekhirin added this pull request to the merge queue Mar 1, 2024
Merged via the queue into main with commit c353b06 Mar 1, 2024
30 checks passed
@shekhirin shekhirin deleted the dani/stack-overflow-handler branch March 1, 2024 16:50
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.

None yet

2 participants