Skip to content

fix: ignore: parallel walker occasionally hangs if visitor panics (#3009)#3328

Open
krapcys1-maker wants to merge 2 commits intoBurntSushi:masterfrom
krapcys1-maker:fix/issue-3009-20260329161236
Open

fix: ignore: parallel walker occasionally hangs if visitor panics (#3009)#3328
krapcys1-maker wants to merge 2 commits intoBurntSushi:masterfrom
krapcys1-maker:fix/issue-3009-20260329161236

Conversation

@krapcys1-maker
Copy link
Copy Markdown

@krapcys1-maker krapcys1-maker commented Mar 29, 2026

Fixes #3009

Summary

Fixes a nondeterministic hang in ignore parallel walk when visitor code panics.

Problem

WalkParallel::visit() / WalkParallel::run() could hang after a panic in visitor logic. The panic did not always terminate worker progression cleanly, leaving threads stuck in work retrieval loops.

Reproduction

From crates/ignore, run parallel tests repeatedly (as described in #3009) until a panic path is hit; on affected code this can hang.

What changed

  • crates/ignore/src/walk.rs
  • In Worker::run, wrap run_one(work) with std::panic::catch_unwind.
  • On panic, call quit_now() before resume_unwind(payload) so all workers observe quit state and stop.

Why this works

The change preserves panic propagation while ensuring global worker shutdown is signaled on panic, preventing the hang/livelock behavior.

Validation

  • cargo check --workspace
  • cargo test -p ignore --lib -- --nocapture

Scope

Single-file, targeted fix in ignore worker loop.

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.

ignore: parallel walker occasionally hangs if visitor panics

2 participants