Skip to content
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

InotifyEmitter thread fails to stop #250

Closed
adiroiban opened this issue Jul 16, 2014 · 3 comments
Closed

InotifyEmitter thread fails to stop #250

adiroiban opened this issue Jul 16, 2014 · 3 comments

Comments

@adiroiban
Copy link
Contributor

I have the following code on Linux with InotifyEmitter https://gist.github.com/adiroiban/064b3a5e07d404ea7109

in order to integrate watchdog with my unit test, I need each test to clean the set of thread it uses and leave the main process clean.

my problem is that inotify thread does not stop... and I have no idea why


I have investigate the code, and the problem is in EventEmitter.run + InotifyEmitter.queue_events combined with InotifyEmitter.on_thread_stop:

The InotifyEmitter.run() method is blocked in InotifyEmitter.queue_events with self._inotify.read_event() ... but then InotifyEmitter.on_thread_stop just closes the self._inotify without emitting some event to unlock the wait in read_event() and push the run() method to a stop.

I will push a fix to be reviewed

thanks!

@tamland
Copy link
Collaborator

tamland commented Jul 16, 2014

but then InotifyEmitter.on_thread_stop just closes the self._inotify without emitting some event to unlock the wait in read_event() and push the run() method to a stop.

No that's how it's stopped. close interrupts the read. However, there is a know issue when all directories are deleted before inotify is closed. (see test_delete_self in test_emitter.py)

@adiroiban
Copy link
Contributor Author

@tamland in my use case, I don't remove any folder. Just start the observer and then press ctrl+c ... and then it will wait forever for inotify thread to stop.

I have added a fix and test and hope it much easier to understand the problem. See #251

@tamland
Copy link
Collaborator

tamland commented Jul 17, 2014

That was clearer, yes. Merged. Thanks!

CCP-Aporia pushed a commit to CCP-Aporia/watchdog that referenced this issue Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants