next.js
1dd198b6 - turbo-tasks-fs: Don't print NotFound watcher errors (#99794)

Commit
8 days ago
turbo-tasks-fs: Don't print NotFound watcher errors (#99794) ### What? Stop the Turbopack disk watcher from printing `watch error … NotFound` for paths that vanish while notify is scanning them, and send the remaining watcher errors to stderr instead of stdout. ### Why? In polling mode, notify's `PollWatcher` walks the tree with walkdir. When a directory is deleted between being listed and being opened or stat'ed, notify reports an `Io` error with `NotFound`. Deleting a large tree (`rm -rf`, a package install) produces a burst of these. A filesystem fuzzer saw about 4000 in two minutes. Each one was printed with `println!`, so a library was spamming the user's stdout. These errors don't signal a correctness problem. The watcher already invalidates the reported path recursively, and the next scan reports the removal anyway. The fuzzer runs had no missed invalidations. ### How? - A small private classifier recognizes notify errors of kind `Io` wrapping `std::io::ErrorKind::NotFound`. It matches on the structured error kinds, not on message text. - The watcher thread skips the print for those errors. Batch invalidation and batch-delay scheduling still run for every error, so invalidation behavior doesn't change. - Other notify error kinds, including `PathNotFound`, are still reported, now on stderr. ### Verification - `cargo test -p turbo-tasks-fs --lib watcher::tests`: 19 passed, covering native and polling watchers in both recursive and non-recursive modes - `cargo clippy -p turbo-tasks-fs --tests -- -D warnings` - Not run: a deletion stress test reproducing the race (the fuzzer finding above). <!-- NEXT_JS_LLM --> <!-- fleet 89bd34bb-fe6a-4ea4-abcc-abb97db76087 --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading