Repository navigation
[kyo-system] the polling watcher confirms an access-denied scan before ending the watch - #2002
Merged
Merged
Conversation
…e ending the watch ## Problem - Windows reads a path that is being deleted as access denied until the deletion completes, where other platforms read it as missing. The polling watcher treated any failing scan as terminal, so removing a watched root failed the stream with `FileAccessDeniedException` instead of emitting `Invalidated`, and a child removed during a scan ended the whole watch. - Seen as PathWatchTest "watcher emits Invalidated when its root is removed" on windows-arm64. ## Solution - A scan that fails with access denied re-arms the loop with the previous snapshot. A successful scan clears the deferral, and a second consecutive denial ends the watch, so a real permission failure surfaces one poll interval later. ## Notes - The new leaves use a file system that reads one target as access denied while a flag is set, which reproduces the Windows behaviour on every platform. - Measured on Windows Server 2025 x64 and Windows 11 arm64: the removal itself never fails, only the concurrent scan does. - Not covered here: `move` of an ancestor of a directory being scanned fails intermittently on Windows with access denied.
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.
Problem
FileAccessDeniedExceptioninstead of emittingInvalidated, and a child removed during a scan ended the whole watch.Solution
Notes
moveof an ancestor of a directory being scanned fails intermittently on Windows with access denied.