-
Notifications
You must be signed in to change notification settings - Fork 330
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
Wrong error message is printed when inotify event queue overflows #191
Comments
I definitely also see different behavior on Linux and Mac OS. fswatch --batch-marker -0 <path> | while read -d "" event; do
...
done; On the Mac – this works reasonably well, while on Linux, this generates an endless event stream. What gives? |
Hi @unphased, could you please put an example invocation? |
Hi @malthe, what kind of changes arrive on |
Hi @unphased, just to clarify:
And then:
If the problem is how chatty |
I just tried to run If you receive a lot of events at the beginning of the session, that's because the hierarchy is scanned recursively and that operation performs events as well. These events are of type |
@emcrisostomo the behavior that i saw on Centos 7, and now Ubuntu 14.04, is that I get an unreasonably large stream of lines that just have a directory path. I will actually save a file in Vim and see NOTHING reported. Yes you are correct in that my language was not very specific, but the point is that the software does not function with any real utility, so what I would like to get to the bottom of is why it works for you but not for us. I will provide you an example soon. |
I think the difference may be accounted for by taking into account:
|
@unphased, as I already asked, you should please add a full example if you want to help us discover what's going on. Not only
What happens in your case, I still don't know. Make a test and dump the output for us to examine, specifying exactly how |
The
That's exactly the opposite. |
Cool, yes I'd like to make it clear (it's hard) that I'm not complaining about how this software isnt doing what it promises to do, but I do believe that way in which the readme is written led me to believe that I can use the tool and expect the same output across the different monitors and this is not the case here, as you've explained. It is only because I formed this expectation that it was particularly frustrating to find that it does not work that way. At any rate, the output IS consistent in several regards: it provides what appears to be an absolute path to the file, and (if Because the difference in monitor behaviors is a limitation in my mind, I feel that it should be called out in that limitations section, in addition to those other limitations already listed which are not immediately encountered. Or another section near the top that highlights this. |
Hi there, just jumped into the same issue. I have an Arch Linux and fswatch It yields |
@valentjedi Since this seems tricky to reproduce, would you please provide all the information you have:
I'll try to fire a VM when I can. |
@valentjedi does fswatch include the created, updated, and removed events as you expect when you use the recursive flag? |
Hi all, sorry for a delay :) @emcrisostomo So here's the example of the command which works great on MacOs:
On Arch it seems to do nothing at first glance, but only if the number of files in the directory is huge. For example, some project root with a big After I've noticed this, I've repeated the experiment on the initial big directory. I decided to wait longer until My guess is that Hope it'll help somehow P.S. I wasn't able to reproduce existing behavior, maybe I overlooked it in the first place. |
Thanks @valignatev, yes, you're right on macOS creating the event stream is basically a effortless operation. On Linux, however, inotify only watches for events on first-level children of a directory. To watch a directory recursively fswatch has to scan the tree and add a watch for each directory in the tree. I'm closing the issue for now because I have no improvements to suggest. Could you give some figures about the number of files and directories in the tree when you experienced these problems? |
Thanks for the response! Interesting. Pure inotifywait works great for me while fswatch chokes on this project. Here's commands I use, both # inotifywait
inotifywait -mr --exclude ignore_patterns_here \
-e modify,create,delete path/to/project/root \
--format "'%w%f'"
#fswatch
fswatch -r0 --event Created --event Updated --event Removed \
--event Renamed \ --event MovedFrom --event MovedTo \
--format '%p' \
ignore_patterns_here -l 0.11 path/to/project/root Also, these calls are wrapped in Hope it'll help somehow |
Thanks for the information @valignatev. I have a gut feeling that what's happening is that the ignored directories may contain a huge number of files. |
Oh yeah they contain a huge number of files. In my particular case I used this command for counting files: |
And this not considered that big for |
Hi @valignatev, I've updated |
Thanks! Sure I'll test it and report back to you! |
Hi again, just tried it. If I also tried to first run fswatch without huge So it seems that it still scans everything upon initial execution (and chokes with a crash), and only then stops to listen for ignored files. I feel we're getting close, thanks a lot for the step in right direction! |
Thank you very much @valignatev. Are you able to replicate the crash? If you are, I'd like you to give me the following information:
This way I should be able to quickly recreate your directory structure and replicate the crash. |
Can't give you a directory tree of an actual project, but I could replicate something similar with one opensource project, which is reactjs. My OS is Arch Linux, also, I've tried this on several terminal emulators. fswatch -r0 --event Created --event Updated --event Removed \
--event Renamed --event MovedFrom --event MovedTo \
--format '%p' -l 0.11 ./
# output is
a&U # Here can be any 3 symbols, even ones which can't be printed
Status code: 1 Here's command which works: fswatch -r0 --event Created --event Updated --event Removed \
--event Renamed --event MovedFrom --event MovedTo \
--format '%p' ./ Also, it works if I ignore fswatch -r0 --event Created --event Updated --event Removed \
--event Renamed --event MovedFrom --event MovedTo \
--format '%p' -e node_modules -l 11 ./ |
Thank you very much @valignatev |
Hi @valignatev, I fixed the bug in develop and a release will be prepared soon. Basically, Finally, you're getting a random output simply because the error handling code in that path is broken. Thanks for your help troubleshooting this issue. If you liked to test it on the |
@emcrisostomo Hi! Thanks a lot for the fixes, I'll try them out and let you know |
Brief testing shows that fswatch works well in this case now. Am I right that you've changed the behavior, so now fswatch ignores such overflows? Also, I've noticed |
Ok, four days in and still works great for me. Can't wait for the release ;) |
Hi @valignatev, yes to all your questions. Thanks for finding the bug and for testing |
update: Much of this issue is explained by realizing that FSEvents monitor works recursively even if you do not specify
-r
, whereas inotify monitor does not function this way. Sorry! The issue still stands. The behavior is extremely different, not only in the output but in the treatment of flags.=======================
I have a workflow which uses fswatch which works very well on os x. Any time a file tracked in git changes I trigger some steps to run (build, show diff, etc) in the terminal.
This works great by piping fswatch output to drive some scripting when new lines of output are produced.
On OS X with FSEvents, fswatch produces a clean format and only one event for files that have been modified. Perfect.
On Linux with inotify_monitor (
fswatch .
) it produces a useless spew of directories and rarely contains a file that is opened for reading. I am using Vim, so I would expect the 4913 file to at least show up in here (as a sanity check) it never does! I'd be fine if what I got was MORE events and I have to simply filter out the file modified events, but even when I use the-x
flag, I do not ever consistently get file modified events.On Linux with poll_monitor, no output is ever produced!
So I'm clearly missing something here because this software is supposed to be a drop-in solution that produces the same outward facing interface on these two different platforms, but what I am seeing are completely different and irreconcilable behavior. So I think that I have some configuration problem. Is my kernel too old? Am I using an incompatible filesystem format? This is Centos 7
3.10.0-514.10.2.el7.x86_64
I can also report that on this system if I simply use
inotifywait -rme modify .
I get reliable output, although sometimes with multiple events when I save a file...The text was updated successfully, but these errors were encountered: