windows: Fix server hangs under some circumstance#674
windows: Fix server hangs under some circumstance#674dfaust merged 15 commits intonotify-rs:mainfrom
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. |
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.
All other log messages start lower case.
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. |
580265c to
3ebaaca
Compare
|
Thank you very much! |
* Add coresponding test * fix * simplify example * fmt * clippy * Even simpler * Better fix * Refactor * Fix * Fix merge conflicts * Fix * add changelog * fix ci * lower case * typo
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.