fix(watch): filter out Access events to prevent infinite rebuild loop on Linux#8557
Merged
hyf0 merged 4 commits intorolldown:mainfrom Mar 6, 2026
Merged
Conversation
… on Linux On Linux, `rolldown-notify` with `TargetMode::TrackPath` registers inotify watches that include `IN_OPEN` and `IN_ATTRIB` flags. When the build process reads watched source files, these flags cause inotify to emit Access events. The previous catch-all `_ => WatcherChangeKind::Update` mapped these Access events to file-change notifications, causing: build reads src → inotify fires IN_OPEN → watcher treats as Update → triggers rebuild → build reads src again → infinite loop Fix: only map Create, Remove, and Modify events to rebuild triggers. All other event kinds (Access, Other, Any) are now ignored. Closes rolldown#8555
@rolldown/browser
@rolldown/debug
@rolldown/pluginutils
rolldown
@rolldown/binding-android-arm64
@rolldown/binding-darwin-arm64
@rolldown/binding-darwin-x64
@rolldown/binding-freebsd-x64
@rolldown/binding-linux-arm-gnueabihf
@rolldown/binding-linux-arm64-gnu
@rolldown/binding-linux-arm64-musl
@rolldown/binding-linux-ppc64-gnu
@rolldown/binding-linux-s390x-gnu
@rolldown/binding-linux-x64-gnu
@rolldown/binding-linux-x64-musl
@rolldown/binding-openharmony-arm64
@rolldown/binding-wasm32-wasi
@rolldown/binding-win32-arm64-msvc
@rolldown/binding-win32-x64-msvc
commit: |
sapphi-red
approved these changes
Mar 6, 2026
Member
sapphi-red
left a comment
There was a problem hiding this comment.
The code looks good to me.
I guess we should align with
rolldown/crates/rolldown_dev/src/bundle_coordinator.rs
Lines 152 to 175 in 1b0ff2d
Treat Modify(Name(RenameMode::From)) as Delete to match the event handling in BundleCoordinator::handle_watch_event, where a rename-from is treated as a file deletion. Ref: rolldown#8557 (review)
Merged
shulaoda
added a commit
that referenced
this pull request
Mar 9, 2026
## [1.0.0-rc.8] - 2026-03-09 ### 🚀 Features - watch: enable full functional fs watcher in wasm (#8575) by @hyf0 - watch: expose debounce related options (#8572) by @hyf0 ### 🐛 Bug Fixes - detect new URL(…, import.meta.url) with no-sub template literal (#8565) by @char - devtools: trace dynamic imports in devtools (#8581) by @cal-gooo - watch: rebuild when a previously missing file is created (#8562) by @hyf0-agent - watch: filter out Access events to prevent infinite rebuild loop on Linux (#8557) by @hyf0-agent ### 🚜 Refactor - watch: remove auto watch for fail imports (#8585) by @hyf0 - fs_watcher: unify the way of constructing watcher (#8571) by @hyf0 - cli: migrate CLI to CAC (#8551) by @h-a-n-a - switch asset module support from hard-code to builtin plugin (#8546) by @hyf0 ### 📚 Documentation - fix subject-verb agreement in why-bundlers.md (#8591) by @brandonzylstra - maintenance: align release and canary workflow guide (#8538) by @minsoo-web - add `format` option to directives example config (#8590) by @shulaoda - fix: change twitter to x logo in team (#8552) by @mdong1909 - correct composable filter support explanation (#8550) by @sapphi-red ### ⚡ Performance - testing: share tokio runtime across fixture tests (#8567) by @Boshen ### 🧪 Testing - hmr: fix infinite loop in dev server test retry logic (#8576) by @hyf0-agent - cli: add more cli-e2e test cases (#8548) by @h-a-n-a ### ⚙️ Miscellaneous Tasks - docs: update in-depth/directives for `output.strict` option (#8535) by @minsoo-web - add PNPM_HOME Dev Drive mapping to Windows CI workflows (#8589) by @Boshen - deps: update github-actions (#8588) by @renovate[bot] - move Windows cargo target dir to Dev Drive (#8586) by @Boshen - optimize cache keys to fix race conditions and reduce usage (#8578) by @Boshen - remove WASI build & test pipeline (#8580) by @Boshen - remove unnecessary submodule checkouts (#8577) by @Boshen - use Dev Drive for Windows CI jobs (#8574) by @Boshen - skip redundant native binding build for browser and remove standalone job (#8573) by @Boshen - parallelize Node tests on ubuntu, single Node 24 on macOS/windows (#8570) by @Boshen - docs: bump @voidzero-dev/vitepress-theme to 4.8.0 (#8558) by @crusty-voidzero - dedupe type-check from dev server workflow (#8554) by @Boshen ### ❤️ New Contributors * @brandonzylstra made their first contribution in [#8591](#8591) * @char made their first contribution in [#8565](#8565) * @cal-gooo made their first contribution in [#8581](#8581) * @hyf0-agent made their first contribution in [#8562](#8562) * @h-a-n-a made their first contribution in [#8551](#8551) Co-authored-by: shulaoda <[email protected]>
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.
Summary
Fix infinite rebuild loop in watch mode on Linux (regression in rc.7).
Closes #8555
Root Cause
rolldown-notifywithTargetMode::TrackPathregisters inotify watches includingIN_OPENandIN_ATTRIBflags. When the build process reads watched source files during bundling, inotify emitsAccessevents (EventKind::Access(Open),Access(Read),Access(Close)).The previous catch-all
_ => WatcherChangeKind::UpdateinTaskFsEventHandler::map_event_kindmapped theseAccessevents to file-change notifications, causing:Evidence from
strace:Evidence from
inotifywait— the only events on source files during each rebuild cycle are reads:Fix
Only map
Create,Remove, andModifyevents to rebuild triggers. All other event kinds (Access,Other,Any) returnNoneand are filtered out before reaching the coordinator.Test Plan
Reproduced on Linux (Ubuntu, kernel 6.14.0) with a minimal project: