dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
242 stars 73 forks source link

Possible race condition when using InotifyTrees #68

Open kiwy42 opened 5 years ago

kiwy42 commented 5 years ago

Hello, Thank you for this nice library it's really handy. I think there could be race condition when using InotifyTrees().
The function build a list to use add_watch() on however as add_watch() do not check if the file or folder exists before adding the watch, it could crash in the process. I happen to have a huge folder that is being watch but this race condition could happen.
I think there could be 2 possible solutions: