Skip to content

fix(ignore): avoid nanosleep busy loop in worker fallback (#2761)#3327

Open
krapcys1-maker wants to merge 1 commit intoBurntSushi:masterfrom
krapcys1-maker:fix/issue-2761-20260329062552
Open

fix(ignore): avoid nanosleep busy loop in worker fallback (#2761)#3327
krapcys1-maker wants to merge 1 commit intoBurntSushi:masterfrom
krapcys1-maker:fix/issue-2761-20260329062552

Conversation

@krapcys1-maker
Copy link
Copy Markdown

Fixes #2761

Summary

Fixes a busy-loop fallback in ignore walker worker scheduling that could spin in nanosleep while another worker is blocked on a FIFO.

Problem

When one worker blocks on a FIFO, other workers can enter a repeated nanosleep cycle in Worker::get_work instead of yielding cleanly.

What changed

  • Replace millisecond sleep fallback in Worker::get_work with scheduler yield (yield_now).

Solution

Use std::thread::yield_now() in the non-blocking stack fallback path so workers stop burning CPU while waiting for progress.

Why

This preserves behavior while reducing unnecessary syscall/CPU churn in stalled traversal scenarios.

Tests

  • cargo test -p ignore walk -- --nocapture
  • cargo test -p ripgrep --tests

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.

rg spins in a nanosleep loop when one thread is blocked on a fifo

2 participants