Skip to content

fix: cap watcher directories to wait-object limit#58

Merged
OpenSteam001 merged 3 commits into
OpenSteam001:mainfrom
H-Chris233:fix-filewatcher-max-wait-objects
May 28, 2026
Merged

fix: cap watcher directories to wait-object limit#58
OpenSteam001 merged 3 commits into
OpenSteam001:mainfrom
H-Chris233:fix-filewatcher-max-wait-objects

Conversation

@H-Chris233
Copy link
Copy Markdown
Contributor

@H-Chris233 H-Chris233 commented May 26, 2026

Problem

FileWatcher passes all watched directories as handles to WaitForMultipleObjects. When the number of directories exceeds MAXIMUM_WAIT_OBJECTS (typically 64), the call fails with WAIT_FAILED. On an empty directory list, WaitForMultipleObjects with zero handles also behaves unexpectedly.

Changes

  1. Cap at MAXIMUM_WAIT_OBJECTS: if the directory count exceeds the OS limit, log a warning and truncate.
  2. Early exit on empty: if no directories are configured, return immediately in both Start() and WatcherThread().
  3. Added warning logs for both edge cases.

Testing

  • Tested with 0, 1, 64, and 65+ directories in the watch list.

@H-Chris233 H-Chris233 force-pushed the fix-filewatcher-max-wait-objects branch 2 times, most recently from 5946118 to 5b362d3 Compare May 27, 2026 00:27
@OpenSteam001 OpenSteam001 merged commit 1cae0f7 into OpenSteam001:main May 28, 2026
2 checks passed
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.

2 participants