-
Notifications
You must be signed in to change notification settings - Fork 220
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
Window's notify thread is stuck hanging #287
Comments
Thanks for this detailed and in-depth report. I'll have a look later on, probably not today. Unfortunately this debouncer of v4 is also completely removed in v5. |
Interestingly, after I fixed this issue - the When the APC queue is not fully cleared, the I have my fix for the first issue mentioned in this post, as well as a stop-gap fix for the APC queue here. I don't know the root-cause of the APC queue issue though. |
Found the reason for the second issue - in Both fixes are here I believe v5 is also affected by the second problem here |
Thanks for all the work! I think we should integrate this fix as a direct PR against try_v4 (for v4 fixes) and main (v5) if you like. Otherwise let me know and I'll make a PR based on your fork. Edit: This could also explain some spurious CI problems before I started maintain this and ultimately led to a removal of most tests and the old debouncer code of v4 in v5. |
How about I do the PR for v4 and you can do it for v5? I was motivated to fix this problem when our tests using notify had flakiness in our CI as well :) |
Sounds good |
System details
rustc --version
: rustc 1.50.0What you did (as detailed as you can)
We created a bunch of
ReadDirectoryChangesWatcher
thrunotify::watcher
. After we dropped theReadDirectoryChangesWatcher
s, we expected the watcher to drop the givenmspc::Sender
.What you expected
Sometimes, the given
mspc::Sender
wouldn't be dropped by theReadDirectoryChangesWatcher
after theReadDirectoryChangesWatcher
was dropped.What happened
I tracked it down to a race condition in the notify crate (4.0.15) under src/debounce/timer.rs.
A particular interleaving of operations could leave the
ScheduleWorker
thread alive while theWatchTimer
thread has dropped.Below is a simplified model of WatchTimer and ScheduleTimer showing the ScheduleTimer hanging after WatchTimer drops:
The creation of
condvar
,stopped
, andthread
are analogous toWatchTimer::new
and storing true instopped
and usingcondvar.notify_one()
is analogous toWatchTimer::drop
.A thread interleaving is enforced via a rendezvous channel. Running this above rust program should show a program hang after "Waiting for condvar" is printed.
The text was updated successfully, but these errors were encountered: