Skip to content

fuzz: use process::exit panic hook in stdin_fuzz to avoid macOS hang#4449

Closed
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:fix-fuzz-panic
Closed

fuzz: use process::exit panic hook in stdin_fuzz to avoid macOS hang#4449
joostjager wants to merge 1 commit intolightningdevkit:mainfrom
joostjager:fix-fuzz-panic

Conversation

@joostjager
Copy link
Contributor

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.

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.
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@joostjager
Copy link
Contributor Author

Hmm it doesn't reproduce anymore now. Probably coming back to this PR later.

@joostjager joostjager closed this Feb 27, 2026
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.94%. Comparing base (ec03159) to head (e674332).

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     
Flag Coverage Δ
tests 85.94% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants