-
Notifications
You must be signed in to change notification settings - Fork 128
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
Error on successive removal of directories being watched #171
Comments
You may run out of fd, that's why this may happen - you can try bumping the limit with e.g. |
@rjeczalik thank you for showing me how to see the debugging output. I ran my program with I literally ran Should I see an event |
@mauricioabreu It's hard to say without seeing the full output, there are a lot of events logged by notify, which are just ignored if not watched y a user. Ideally a repro program would be helpful, or a test event more - if you think there's wrong behaviour somewhere please add a test for it, it'd be really helpful (see watcher_inotify_test.go). |
@rjeczalik of course. Sorry for not providing examples with code. I will do it, I did not mean to be rude or lazy.
I asked that question because my notify initalization does not cover func NewFileWatcher(rootPath string, files chan string, isRecursive bool) (*Watcher, error) {
if isRecursive {
rootPath = filepath.Join(rootPath, "...")
}
watcher := &Watcher{
eventStream: make(chan notify.EventInfo, 1),
Files: files,
rootPath: filepath.Clean(rootPath),
}
if err := notify.Watch(rootPath, watcher.eventStream, notify.InCloseWrite, notify.InMovedTo); err != nil {
logrus.Fatal(err)
}
return watcher, nil
} One last thing I noticed is the
Not sure if these events are related. Thanks again! I will provide a test case for it soon. |
I created a repository demonstrating the problem: https://github.com/mauricioabreu/notify-issue-171 Here I paste the output of the program:
As we can see, there is an error |
Usually increasing buffer size for the receiving buffer fixes the issue. Other question is do you really need to process that many events at that pace. |
Thanks for the answer! What do you mean by About the number of events, this problem also happens if you do it manually (slow or fast). So I guess it is not a performance issue, right? Important information: my example runs on a |
This is interesting, are you able to reproduce this issue from a docker container? Does it drop events if you use QueuedWatch instead of notify.Watch? |
Yes, here is the project/container I created to demonstrate this: https://github.com/mauricioabreu/notify-issue-171 The I used |
Reading the debug output, we can see that the directories being created/removed are being notified, but not their files (or even their subdirectories). With this information, I am debugging and reading the source code on how |
I am wondering if it is related to the way |
First of all, thanks for this library.
I have a problem here but I don't know how to fix it. I am watching a directory recursively, for example:
/home/foo/...
. There is a process (I don't control) that removes the directories being watched under thefoo
. I noticed the following behaviours:Do you have any idea of what is the source of this problem? I used
inotify-tools
to check if it was aninotify
bug but I continue to receive the events of these removed directories there.The text was updated successfully, but these errors were encountered: