You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Close removes all watches and closes the events channel.
func (w*Watcher) Close() error {
ifw.isClosed() {
returnnil
}
// Send 'close' signal to goroutine, and set the Watcher to closed.
close(w.done)
Is it possible that two concurrent goroutines running Close() could both pass the check function w.isClosed() and then both call close(w.done)? That would result in two closes of the channel and a panic.
One solution would be to lock the w.mu at least around the w.IsClosed and close(w.done) calls.
Hi!
Thanks a lot for this library.
Looking at the code I'm suspicious that there is a race in Close():
fsnotify/inotify.go
Lines 72 to 80 in 7f4cf4d
Is it possible that two concurrent goroutines running Close() could both pass the check function
w.isClosed()and then both callclose(w.done)? That would result in two closes of the channel and a panic.One solution would be to lock the
w.muat least around thew.IsClosedandclose(w.done)calls.