As a result of the fix in #73, watch.Remove() now synchronously waits for the main fsnotify goroutine (readEvents()) to receive and process the IN_IGNORED event that the kernel sends to acknowledge the removal of the watch descriptor. But there could be other inotify events delivered in between, and this can easily cause readEvents() to attempt to dispatch an event to someone waiting for readEvents() to process the IN_IGNORED event, hence the deadlock.
An example of this issue can be found in hpcloud/tail#75 (along with a workaround for that code).
As a result of the fix in #73,
watch.Remove()now synchronously waits for the main fsnotify goroutine (readEvents()) to receive and process theIN_IGNOREDevent that the kernel sends to acknowledge the removal of the watch descriptor. But there could be other inotify events delivered in between, and this can easily causereadEvents()to attempt to dispatch an event to someone waiting forreadEvents()to process theIN_IGNOREDevent, hence the deadlock.An example of this issue can be found in hpcloud/tail#75 (along with a workaround for that code).