could not watch local filesystem for changes – too many open files
I just started getting this repeatedly on macOS:
FATA[0026] could not watch local filesystem for changes: open /Users/ilya/Code/nodejs-prometheus-demo/.git/objects/15: too many open files
Perhaps we can limit files to watch? ...nothing in .git actually needs to be watched directly, may be we could rely on .gitignore (if present) or otherwise have a config parameter of our own.
We could also print a more helpful message when this error occurs, e.g. we could suggest user what command to run to raise the limits permanently and mention the config option and .gitignore (once that's implemented).
I've resolved it with git gc, but I really only start on this project, so I think the chances to hit this error are rather high.
It was long until I got this error again, this time after I happen to create a bunch of files in the projects directory with npm install.
related: https://github.com/Azure/draft/issues/3
also https://github.com/Azure/draft/issues/9 is tracking the .draftignore conversation. :)
It sounds like we are watching the files but ignoring the events instead of completely removing them from the file watcher. I'm not sure if that's possible given how recursive file watchers work.
Out of curiousity, which operating system are you running under, and can you show the contents of ulimit -a if on macOS/linux/unix?
I've been bitten by this as well. Super annoying.
It most likely would not address this issue, but I was pointed at http://entrproject.org/ a while back as a way to run arbitrary commands when files change. It might have some niceties that help with this, but I haven't dug in.
I know on my personal machine the default number of open files you can have at any given time is at 256 (according to ulimit -a), so it seems like it's a very easy limit to hit if we're watching everything in .git/.
@ultimateboy that's certainly a curious project! Not necessarily recursive watching in the sense that it'll detech if a file has been created, but it will watch a list of existing files that are supplied to entr. I wonder if there's a way we could incorporate that into the watch functionality instead by doing a recursive search on all files NOT present in .draftignore, then just watch those files specifically for any change. I think that could handle the 90% use case... It would just miss out on the 10% that would want the file watcher to notice new files being created in src/. I'd be happy with that trade-off for now.