Skip to content

[kyo-system] the polling watcher confirms an access-denied scan before ending the watch - #2002

Merged
fwbrasil merged 1 commit into
mainfrom
pr-kyo-system
Sep 27, 2026
Merged

fwbrasil merged 1 commit into
mainfrom
pr-kyo-system

Conversation

@fwbrasil

Copy link
Copy Markdown
Collaborator

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.

…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.
@fwbrasil
fwbrasil merged commit 40a6745 into main Sep 27, 2026
16 of 28 checks passed
@fwbrasil
fwbrasil deleted the pr-kyo-system branch September 27, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant