Turbopack: Fix polling watcher dropping rapid edits - #97339
Closed
marcoshernanz wants to merge 1 commit into
Closed
Conversation
Co-Authored-By: Marcos Hernanz <96699542+marcoshernanz@users.noreply.github.com>
Contributor
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
Build Cache
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URLCommit: dfef8c7 |
Contributor
Tests PassedCommit: dfef8c7 |
This comment has been minimized.
This comment has been minimized.
Member
|
I don't think this feature is important enough to justify maintaining a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes Turbopack polling mode permanently dropping rapid file edits by pinning a
notify8.2.0 backport that preserves subsecond file mtime precision.Adds a deterministic
turbo-tasks-fsregression test that advances a watched file's mtime twice within one second and verifies the task is invalidated.Upstream dependency fix: notify-rs/notify#981
Why?
watchOptions.pollIntervalMsselectsnotify::PollWatcher. Releasednotifyversions convertSystemTimeto whole seconds before comparing snapshots. With content hashing disabled, two writes within the same second compare equal, so the second edit emits no event and remains stale until a later edit changes the truncated timestamp.This is not Windows-only:
canaryon Linux: one polling run detected 24/25 edits and never recovered within the 8-second observation window; native control detected 25/25.notify.PR #96440 correctly handles
WriteTimeevents once emitted, but cannot recover an event thatPollWatchernever produces.The behavior affects the intended Docker/WSL/network-filesystem polling escape hatch. Related reports include #80665, #80687, #71622, and #94146.
How?
The pinned dependency keeps nanosecond precision for ordinary files without enabling
compare_contents, which would hash every watched file on every poll. It retains whole-second behavior for directories and content-hashed watchers to avoid additional directory events and preserve existing event classification.The pin is based on stable
notify8.2.0 rather than 8.1.0, so it includes the intervening inotify fixes. A TODO links the upstream PR for removal after release.Verification
notify8.2.0 backport: 10 passed, 1 ignored; 5 doc tests passednotify: 82 passed, 2 ignored; hashing/race/serialization integration tests and 8 doc tests passedcargo test -p turbo-tasks-fs: 119 passedcargo fmt --all -- --checkcargo clippy -p turbo-tasks-fs --tests -- -D warningsFixes #96982