draft-classic icon indicating copy to clipboard operation
draft-classic copied to clipboard

could not watch local filesystem for changes – too many open files

Open errordeveloper opened this issue 8 years ago • 9 comments

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).

errordeveloper avatar Jun 07 '17 11:06 errordeveloper

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.

errordeveloper avatar Jun 07 '17 11:06 errordeveloper

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.

errordeveloper avatar Jun 07 '17 13:06 errordeveloper

related: https://github.com/Azure/draft/issues/3

bacongobbler avatar Jun 07 '17 15:06 bacongobbler

also https://github.com/Azure/draft/issues/9 is tracking the .draftignore conversation. :)

bacongobbler avatar Jun 07 '17 15:06 bacongobbler

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.

bacongobbler avatar Jun 07 '17 15:06 bacongobbler

Out of curiousity, which operating system are you running under, and can you show the contents of ulimit -a if on macOS/linux/unix?

bacongobbler avatar Jun 07 '17 17:06 bacongobbler

I've been bitten by this as well. Super annoying.

gabrtv avatar Jun 07 '17 17:06 gabrtv

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.

ultimateboy avatar Jun 07 '17 17:06 ultimateboy

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.

bacongobbler avatar Jun 07 '17 18:06 bacongobbler