Skip to content

repro: a panicked scan worker leaves the scanner busy forever - #2720

Draft
dorianvp wants to merge 1 commit into
devfrom
repro/worker-panic-wedges-scanner
Draft

repro: a panicked scan worker leaves the scanner busy forever#2720
dorianvp wants to merge 1 commit into
devfrom
repro/worker-panic-wedges-scanner

Conversation

@dorianvp

Copy link
Copy Markdown
Member

Claim

A panic inside scan(..) leaves a ScanWorker busy forever, so the scanner ticks without progress and without an error.

  • pepper-sync/src/scan/task.rs:660-690: ScanWorker::run spawns a tokio task and stores the JoinHandle in self.handle, but nothing ever polls it. is_scanning is stored false only at the end of the loop body, after scan(..) returns.
  • pepper-sync/src/scan/task.rs:585: Loader::check_error shows the pattern that is missing for workers.
  • pepper-sync/src/scan/task.rs:169: Scanner::idle_worker only returns workers with is_scanning == false.
  • pepper-sync/src/scan/task.rs:252: ScannerState::Shutdown only drains idle workers.
  • pepper-sync/src/scan.rs:142-154: scan panics on .expect("compacts blocks should not be empty") and on panic!("compact blocks do not match scan range!"), which are reachable from server data.

What the test does

scan::task::tests::panicked_scan_worker_is_reported_or_idle builds a ScanWorker with MainNetwork params, empty ufvks, and an unbounded results channel, calls run(1024), and sends a ScanTask for range 10..20 with no compact blocks. After 500 ms it asserts the invariant that a panicked worker is either reported (an Err on the results channel) or marked idle.

Observed output on current dev

thread '...' panicked at pepper-sync/src/scan.rs:144:10:
compacts blocks should not be empty

thread '...' panicked at pepper-sync/src/scan/task.rs:895:9:
a panicked scan worker must be reported or marked idle, but is_scanning=true and no result was sent

test result: FAILED. 0 passed; 1 failed

The worker task is finished (handle.is_finished() == true), the JoinError is never observed, is_scanning stays true, and nothing is sent on the results channel.

Notes

This PR is a reproduction only and does not contain a fix. The sync-bench A/B rule was not run because the commit adds a test only.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant