Fall back to inotify when filesystem has errors in fanotify (fix watch in Docker)#4661
Open
johnfav03 wants to merge 1 commit into
Open
Fall back to inotify when filesystem has errors in fanotify (fix watch in Docker)#4661johnfav03 wants to merge 1 commit into
johnfav03 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automatic inotify fallback when fanotify cannot watch Docker-backed filesystems.
Changes:
- Introduces an unsupported-filesystem sentinel error.
- Tags relevant fanotify failures and switches the watch manager to inotify.
- Adds focused fallback and error-propagation tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/fswatch/watcher.go |
Defines the filesystem-support error. |
internal/fswatch/fanotify_linux.go |
Classifies unsupported filesystem errors. |
internal/fswatch/fanotify_linux_test.go |
Tests error classification and propagation. |
internal/execute/watchmanager/watchmanager.go |
Implements backend fallback and watch re-registration. |
internal/execute/watchmanager/watchmanager_fallback_test.go |
Tests fallback behavior and production wiring. |
jakebailey
reviewed
Jul 21, 2026
| } | ||
|
|
||
| func maybeWrapUnsupportedFilesystem(err error) error { | ||
| if errors.Is(err, unix.EOPNOTSUPP) || errors.Is(err, unix.ENOTSUP) || errors.Is(err, unix.ENODEV) { |
Member
There was a problem hiding this comment.
Hm, I guess this comes down to cross-mount watching?
Won't this totally disable the method whenever we detect any unsupported watch?
I do wonder if there's instead some hybrid backend we can do that falls back to inotify for dirs we seemingly can't fanotify.
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.
Fixes microsoft/TypeScript#63646
Some filesystems, notably Docker bind mounts on macOS and Docker containers' root filesystems, don't implement
name_to_handle_at. This is an issue because we default to fanotify for Linux environments, but in these Docker filesystems everyfanotify_markfails withEOPNOTSUPP, so none of the directory watches are ever registered. This results in the initial build succeeding, but subsequent file changes not being detected.In the fix, when the backend defaults to fanotify and
ReconcileWatchesfails withErrFilesystemUnspported,WatchManagercloses any existing watches, switches to an inotify backend, and re-registers the desired watch set.