fuzz: use process::exit panic hook in stdin_fuzz to avoid macOS hang#4449
fuzz: use process::exit panic hook in stdin_fuzz to avoid macOS hang#4449joostjager wants to merge 1 commit intolightningdevkit:mainfrom
Conversation
On macOS, panic=abort causes the process to call abort() which sends SIGABRT. The ReportCrash daemon then tries to generate a crash report, leaving the process stuck in an uninterruptible wait state that cannot be killed even with SIGKILL. This makes stdin_fuzz unusable for crash reproduction on macOS. Install a custom panic hook that flushes stdout (preserving log output), prints the panic info with a full backtrace to stderr, then calls process::exit(1) to terminate cleanly before the abort machinery runs. The hook has zero overhead during normal execution since it is only invoked when a panic occurs. AI tools were used in preparing this commit.
|
🎉 This PR is now ready for review! |
|
Hmm it doesn't reproduce anymore now. Probably coming back to this PR later. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4449 +/- ##
=======================================
Coverage 85.93% 85.94%
=======================================
Files 159 159
Lines 104693 104693
Branches 104693 104693
=======================================
+ Hits 89972 89980 +8
+ Misses 12213 12208 -5
+ Partials 2508 2505 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Reopening this, because indeed the bug isn't fixed on main. Repro:
|
| // On macOS, panic=abort causes the process to send SIGABRT which can leave it | ||
| // stuck in an uninterruptible state due to the ReportCrash daemon. Using | ||
| // process::exit in a panic hook avoids this by terminating cleanly. | ||
| std::panic::set_hook(Box::new(|panic_info| { |
There was a problem hiding this comment.
Can we restrict this to macOS, then? I'd prefer to not break GDB on Linux just because macOS is buggy trash.
|
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
Unfortunately the final approach chosen in #4430 did not prevent the hang-on-panic. Must have made a mistake in the final validation of stdin_fuzz.