Skip to content

fix: don't spin forever on unhandled file change actions (windows) - #1152

Merged
mfisher31 merged 1 commit into
mainfrom
element-exe-non-scanner-hang
Aug 12, 2026
Merged

fix: don't spin forever on unhandled file change actions (windows)#1152
mfisher31 merged 1 commit into
mainfrom
element-exe-non-scanner-hang

Conversation

@mfisher31

Copy link
Copy Markdown
Member

The Windows FileSystemWatcher walked the FILE_NOTIFY_INFORMATION list with a that skipped unknown actions without advancing to the next entry, so any notification Windows delivers outside the five handled actions (alternate data stream and file id notifications, as generated by OneDrive and similar) pinned the watcher thread in an infinite loop at 100% CPU while holding its lock. The thread then no longer reached threadShouldExit(), so shutdown fell back to TerminateThread and the process could outlive a normal quit.

Skip unrecognized actions instead of looping on them, bound the buffer walk by the returned byte count, align the buffer as ReadDirectoryChangesW requires, and stop retrying a failed read in a tight loop (recovering on ERROR_NOTIFY_ENUM_DIR with a full folder refresh).

The Windows FileSystemWatcher walked the FILE_NOTIFY_INFORMATION list with
a  that skipped unknown actions without advancing to the next
entry, so any notification Windows delivers outside the five handled
actions (alternate data stream and file id notifications, as generated by
OneDrive and similar) pinned the watcher thread in an infinite loop at
100% CPU while holding its lock.  The thread then no longer reached
threadShouldExit(), so shutdown fell back to TerminateThread and the
process could outlive a normal quit.

Skip unrecognized actions instead of looping on them, bound the buffer
walk by the returned byte count, align the buffer as ReadDirectoryChangesW
requires, and stop retrying a failed read in a tight loop (recovering on
ERROR_NOTIFY_ENUM_DIR with a full folder refresh).
@mfisher31 mfisher31 self-assigned this Aug 7, 2026
@mfisher31 mfisher31 moved this to In progress in Element 1.2.x Aug 7, 2026
@mfisher31
mfisher31 marked this pull request as ready for review August 8, 2026 12:39
@mfisher31 mfisher31 moved this from In progress to In review in Element 1.2.x Aug 10, 2026
@mfisher31
mfisher31 merged commit 54c1d41 into main Aug 12, 2026
5 checks passed
@mfisher31
mfisher31 deleted the element-exe-non-scanner-hang branch August 12, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant