hannobraun / inotify-rs

Idiomatic inotify wrapper for the Rust programming language
ISC License
254 stars 65 forks source link

On Linux directory watcher stops after emitting first couple of events #136

Closed mitchmindtree closed 4 years ago

mitchmindtree commented 4 years ago

I'm using notify in a personal, downstream rust hotloading project, where the src directory is watched recursively in order to re-build the lib if a change happens to any of the src files.

I'm running into an issue where the watcher will only emit events for the first two or three file events that occur when writing to src/lib.rs, and then will suddenly stop reporting any events at all.

This same issue seems to occur on both versions 4 and 5-pre, both for raw and debounced watchers. I haven't yet tested master.

I haven't yet honed in on whether or not there is an event in particular that causes the stoppage. I haven't yet tested if this occurs with non-recursive mode.

I noticed the shade_runner crate also uses notify for its file events but it does not seem to have this issue. One major difference worth investigating is that shade_runner watches individual files rather than a directory, so perhaps the issue has something to do with watching directories in particular.

I'm going to do some digging today to see if I can work out exactly what's going on.

mitchmindtree commented 4 years ago

Woops! I meant to submit this to notify-rs/notify! I doubt the issue is in inotify itself.

mitchmindtree commented 4 years ago

Here's a link to the actual issue in case anyone is interested: https://github.com/notify-rs/notify/issues/218