Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

osx watcher limit #89

Open
b1lly opened this issue Feb 14, 2014 · 6 comments
Open

osx watcher limit #89

b1lly opened this issue Feb 14, 2014 · 6 comments

Comments

@b1lly
Copy link

b1lly commented Feb 14, 2014

Is there currently a work around for this osx watcher limit?

@nathany
Copy link
Contributor

nathany commented Feb 14, 2014

We currently use kqueue on OS X which is limited to 10,240 open file descriptors (number of files watched). I found this article to increase the limit but I haven't tried to do so myself:
http://krypted.com/mac-os-x/maximum-files-in-mac-os-x/

@b1lly
Copy link
Author

b1lly commented Feb 14, 2014

hm... thanks for responding.

I'm currently creating one watcher that watches 28 unique directories. It's throwing the "to many files open" error on mac osx. This doesn't seem anywhere close to the limit? The directories aren't big at all, so I'm unsure why this would happen.

@nathany
Copy link
Contributor

nathany commented Feb 15, 2014

File descriptors are used for other things too, even if you're only using a few hundred. I'm not aware of any other limits besides # of files.

One thing you might check is to ensure you aren't watching hidden directories like .git. That could add significantly to the # of files.

fsnotify currently watches all the files in the directories you specify. I'm currently investigating what can be accomplished by just watching directories:
https://groups.google.com/d/msg/golang-dev/bShm2sqbrTY/vEvLBB3sIdkJ

It's also possible that someone will contribute an FSEvents adapter #54 which is geared for watching directory structures.

Sorry I don't have an immediate solution for you.

@nathany
Copy link
Contributor

nathany commented Feb 22, 2014

"The default per-process descriptor limit on current versions of OS X is extremely low (256!). "

From the Watchman README

@pifantastic
Copy link

Just to throw this out there, node's gaze (https://github.com/shama/gaze#errors) library detects EMFILE errors and fallsback to polling. Would it be terrible to do the same here? Maybe with an option to not fallback for people who can't allow the performance hit?

In my case, I want to know if any file in a directory changes, with the potential for large numbers of files. It looks like I'll need to build my own wrapper for fsnotify that falls back to polling. If I know that there is a potential to roll that functionality into fsnotify, I can build it with that in mind.

@nathany
Copy link
Contributor

nathany commented May 20, 2014

@pifantastic Based on the discussions around inclusion of os/fsnotify in standard library, I suspect a separate polling package would be best, but you can bring it up on the golang-dev list if you like.

The event structure and API are sure to change from what we have now: https://goo.gl/MrYxyA

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants