Skip to content

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

Merged
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
joostjager:fix-fuzz-panic
Mar 20, 2026
Merged

fuzz: use process::exit panic hook in stdin_fuzz to avoid macOS hang#4449
TheBlueMatt merged 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.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Feb 27, 2026

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@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 86.17%. Comparing base (ec03159) to head (39c8b0c).
⚠️ Report is 128 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4449      +/-   ##
==========================================
+ Coverage   85.93%   86.17%   +0.24%     
==========================================
  Files         159      160       +1     
  Lines      104693   107441    +2748     
  Branches   104693   107441    +2748     
==========================================
+ Hits        89972    92592    +2620     
- Misses      12213    12233      +20     
- Partials     2508     2616     +108     
Flag Coverage Δ
tests 86.17% <ø> (+0.24%) ⬆️

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.

@joostjager joostjager reopened this Mar 19, 2026
@joostjager
Copy link
Contributor Author

joostjager commented Mar 19, 2026

Reopening this, because indeed the bug isn't fixed on main. Repro:

  • Add panic at top of chanmon_consistency::do_test

  • echo -ne '\xa4' | RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo +nightly run --features stdin_fuzz --bin chanmon_consistency_target (bytes irrelevant)

@joostjager joostjager requested a review from TheBlueMatt March 19, 2026 09:37
@joostjager joostjager marked this pull request as ready for review March 19, 2026 09:37
@joostjager joostjager self-assigned this Mar 19, 2026
@ldk-reviews-bot
Copy link

👋 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.

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 (gated behind #[cfg(target_os = "macos")])
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 is only installed on
macOS to avoid interfering with debuggers like GDB on Linux.

AI tools were used in preparing this commit.
@ldk-claude-review-bot
Copy link
Collaborator

@joostjager joostjager requested a review from TheBlueMatt March 20, 2026 11:16
@TheBlueMatt TheBlueMatt merged commit 4baa2f3 into lightningdevkit:main Mar 20, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants