Fix deadlock when watching files with inotify#76
Merged
Nino-K merged 3 commits intohpcloud:masterfrom Apr 8, 2016
Merged
Conversation
Calling watcher.Remove() from the run() goroutine is now problematic, because with the change made in fsnotify/fsnotify#73 Remove() can now take an arbitrary amount of time, which means we can deadlock if run() is waiting for fsnotify to acknowledge the removal and fsnotify is trying to send an unrelated Event. So instead we now do part of the cleanup, including calling Remove(), synchronously, in the goroutine trying to unsubscribe. This fixes hpcloud#75. Thanks to Aaron Beitch for the fix. Change-Id: I346c9eecc34b2378312b07b3c3efc41616b95380
Change-Id: I0f9b88fc327b169c748794e86efb0aa0a03b3e2a
Change-Id: Ic744312efa91cf5c2dc2810e597353a080dccb70
Contributor
|
@tsuna Thanks for you contribution, your PR is now merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calling
watcher.Remove()from therun()goroutine is now problematic, because with the change made in fsnotify/fsnotify#73Remove()can now take an arbitrary amount of time, which means we can deadlock ifrun()is waiting for fsnotify to acknowledge the removal and fsnotify is trying to send an unrelatedEvent.So instead we now do part of the cleanup, including calling
watcher.Remove(), synchronously, in the goroutine trying to unsubscribe.This fixes #75. Thanks to @aaronbee for the fix.