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
Inconsistent event paths from Docker on macOS #584
Comments
Can you try the latest main branch? There's been quite a few changes, so it may already be fixed/improved. I should probably tag a new version (I wanted to get the recursive watcher finished first, but that's been taking a longer than I expected). Also, if it still fails, a (short) program to reproduce the issue would be helpful (though not required); there's a |
I tried using the latest in |
I only have a QEMU machine for macOS, which just barely functions as-is. Trying to run Docker inside that would probably melt the laptop, desk, chair, and quite likely the rest of the house (if it even works at all). I could try Docker on Linux host, but if I can't reproduce it there then it's highly unlikely I'll work on it any time soon. |
I understand. For the time being I will try to use a heuristic to solve the problem, knowing that some paths will drop from watching under bad conditions. Maybe one day someone with a MacOS could pick this up or maybe I can find the time to dive into the depths of kqueue and try and tackle it myself 🤷 . Anyway, thanks for the quick replies and trying to help out. |
Actually looking at this again, you shouldn't get any events for step 2, since you're watching ".../internal", and not ".../internal/foo", so I guess you're setting up a watcher for that directory? I think this may be related to a specific usage pattern rather than "docker on macOS". This should have a program to reproduce the issue, or a test script. In the main branch you can just add those in testdata, like so:
And then run it with something like:
Don't need to set TMPDIR, but may be useful in case it can only be reproduced on some filesystems/directories. For more docs on that, see: https://github.com/fsnotify/fsnotify/blob/main/CONTRIBUTING.md#writing-new-tests |
Yes, you are right. I traverse directories and add watches to them manually. It's been a while since I last played around with the tool (since the older version works ok-ish and does the job). Once I have a bit more free time, I will give your test script a try. It looks like a good way to narrow it down. |
Cheers, or any way to reproduce it. I don't care about the exact form, some Go code combined with a shell script is also fine. |
Describe the bug
Hi,
I have been developing a tool for automatic rebuilding and restart of Go applications. It uses
fsnotify
to track for file changes in a recursive way. The problem is that in some situations the events produced by fsnotify are not as per documentation.For example, the following scenario breaks it (Linux):
Create a folder
foo
Create file
bar
insidefoo
Delete folder
foo
Create folder
foo
againCreate file
bar
insidefoo
againEmpty Trash
At step 4 and 5 things start to break. It reports events with empty names or not relative to anything.
I observe similar when using my tool inside Docker container on a MacOS host. Except that there the events are
REMOVE
instead ofRENAME
.In the past I have used my own internal tracking of files and folders that I have passed to fsnotify watcher. That way, when a file or folder is removed, I manually call
Watcher.Remove
for it and all its children. This helps when doing the simple scenario from above but under hight stress (go mod vendor
and the likes) it fails again.To Reproduce
Not a one-liner. I can try and provide a branch of my tool that can reproduce it consistently.
Which operating system and version are you using?
Observed both on Linux (where RENAMEs are reported), as well as in Docker container on MacOS (where REMOVEs are reported).
Which fsnotify version are you using?
1.6.0
Did you try the latest main branch?
No
The text was updated successfully, but these errors were encountered: