-
Notifications
You must be signed in to change notification settings - Fork 180
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
Race condition or deadlock in Close() #72
Comments
This seems to happen when a file event comes in after |
There is at least one deadlock going on here. When I was able to work around it by dumping the 'extra' events around the call to case <-time.After(200 * time.Millisecond):
if haveChange {
logger.Println("we have enough changes")
quit := make(chan bool)
go func() {
for {
select {
case event := <-w.Event:
logger.Println("extra event:", event.Name())
case <-quit:
return
}
}
}()
w.Close()
quit <- true
return
} It feels like this is something that watcher should handle. If I have time I'll see if I can fix it in a more elegant way inside of watcher, and submit a pr. |
Even I am facing same issue with my application. Application hangs and unable to process new event .I believe this should be handled inside watcher package . |
It's not documented, but essentially in the current implementation it's not supported to call |
Regarding allowing |
I am having a pretty terrible time trying to debug this. Things seem to get hung up in multiple places inside of
Close()
.There are times when it fails to obtain a lock and just gets stuck there forever. And there are times when it can't seem to send on
w.close
. Any help would be appreciated.I've added some logging to
Close()
like so.In some instances, the last message I get is
=== starting close
. And in some instances it is=== sending close
. And then other times it works just fine.Here is the code I am using. Let me know if you need to see more.
It is probably worth noting that the directory I am watching contains about 6000 files.
Thanks in advance.
The text was updated successfully, but these errors were encountered: