-
Notifications
You must be signed in to change notification settings - Fork 254
windows: Fix server hangs under some circumstance #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6d0e731 to
ab92967
Compare
|
Moving a folder to the Recycle Bin or deleting a folder triggers
Interestingly, when the folder is deleted instead of moved to the Recycle Bin, the second Changes in this PR:
|
|
Hi @JunkuiZhang. Thanks so much for fixing this issue. The changes look good. |
206d29f to
6647e8f
Compare
I’ve rebased my changes onto the |
|
Thanks for the quick update. [target.'cfg(windows)'.dev-dependencies]
trash.workspace = trueShould fix the CI issue. |
dfaust
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found two micro issues :)
notify/src/windows.rs
Outdated
| _ => { | ||
| // Some unidentified error occurred, log and unwatch the directory, then return. | ||
| log::error!( | ||
| "Unknown error in ReadDirectoryChangesW for directory {}: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All other log messages start lower case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
notify/src/windows.rs
Outdated
| return; | ||
| } | ||
| ERROR_ACCESS_DENIED => { | ||
| // This could hanppen when the watched directory is deleted or trashed, first check if it's the case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
580265c to
3ebaaca
Compare
|
Thank you very much! |
Hi, thank you so much for creating such a high-quality Rust library.
We encountered a tricky issue while using this library in the development of Zed (https://github.com/zed-industries/zed). After testing, we identified the issue as a bug in
notify. This PR provides a test case,test_windows_trash_dir(), which reproduces the bug.The bug can be reproduced as follows: in a project directory
/path/to/project, there is a subfolder/path/to/project/child. If we monitor changes in the child folder, then move the child folder to the trash (deleting the folder directly does not trigger the bug), and monitor the project directory, the server gets stuck at theWaitForSingleObjectExcommand.This issue seems to be related to thebAlertableflag inWaitForSingleObjectEx, but we are still unclear why settingbAlertabletoTRUEcauses this bug.