-
Notifications
You must be signed in to change notification settings - Fork 128
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
NonrecursiveTree does not watch recreated folders #200
Closed
FabianKramm opened this issue
Jan 27, 2021
· 0 comments
· Fixed by syncthing/notify#3 or syncthing/syncthing#7444
Closed
NonrecursiveTree does not watch recreated folders #200
FabianKramm opened this issue
Jan 27, 2021
· 0 comments
· Fixed by syncthing/notify#3 or syncthing/syncthing#7444
Comments
imsodin
added a commit
to syncthing/notify
that referenced
this issue
Feb 9, 2021
imsodin
added a commit
to syncthing/notify
that referenced
this issue
Mar 8, 2021
This was referenced Mar 8, 2021
rjeczalik
added a commit
that referenced
this issue
Jun 12, 2021
Fixes for non-recursive tree when dirs are deleted (fixes #200)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there! I think I found a rather severe issue on operating systems that use the NonrecurseTree watcher like linux for recursive watches. The problem is that after you create and delete a folder several times, no subsequent events for that folder will be logged anymore.
I think that the underlying problem is that the non-recursive tree implementation only adds directories to watch and never deletes them from the internal tree structure (except if you call Stop() manually from the outside). This can be seen in the
func (t *nonrecursiveTree) dispatch(c <-chan EventInfo)
function:notify/tree_nonrecursive.go
Lines 67 to 75 in e2a77dc
Here only 'Create' events are forwarded to the internal handler that adds new watchpoints. However, when a directory is actually removed and recreated, the underlying inotify watch does not work anymore and the tree implementation does not re-add it because it thinks the folder is still being watched, because there is a node for it already in the internal in-memory tree. This means that all subsequent events are lost for this folder and it is essentially unwatched until you restart the complete watcher.
I guess this could be also the reason for some other issues like #190 or syncthing/syncthing#7198
The problem can be reproduced on linux with this snippet:
The text was updated successfully, but these errors were encountered: