Skip to content

Removing watches from a goroutine consuming fsnotify events can lead to a deadlock #123

@tsuna

Description

@tsuna

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions