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
Large number of watchers starts failing hard on OSX #645
Comments
Did you raise the open file descriptor limit (see ulimit)? (Node used to do it automagically, but I'm not sure if that is the case now) |
/cc @indutny |
|
Do a |
Thanks (I feel like a noob now). |
If #641 solves it (I should know soon enough), I hope that can make it into the next release. |
I compiled and tried to run it, but the output is exactly the same, which is really odd because the error (2nd line) mentions kqueue, while the commit message in #641 says it should not be using kqueue at all anymore. |
@ronkorving note that the error comes from the OSX framework itself. |
The office has closed, so I will have to try with someone tomorrow. We tried to bump it, but it wouldn't let us... I'm sure there's a way, but I don't know that way off the top of my head. Will have to postpone until tomorrow I'm afraid. |
No worries. |
@ronkorving this is unfixable, OS X has a global OS limit. Sorry! |
Ah, wait... This is something different. (Gosh premature commenting) |
@ronkorving seems to be |
We upped the ulimit from 1000 to 3000, and the same errors appear. So it seems unrelated to this error. @indutny any idea what that global OS limit is? (is it lower than ulimit can communicate it to be?) |
What does your code do? Use fs.watch on a thousand different files? Can you come up with a test case which consists just of core modules?
|
I could give it a shot, but right now (for the sake of the project) I'm focused on non-watch fast build solutions in Webpack (which, thank god, exist). What is happening behind the scenes in Webpack exactly, I don't know, but I can look into that and get back to you. |
It seems it's using chokidar behind the scenes. You may be familiar with it? source: https://github.com/webpack/watchpack/blob/master/lib/DirectoryWatcher.js#L7 |
No, I'm not familiar with that. I see it uses fs.watch* and fsevents, but I see nothing we can fix from libuv. |
Note that the limit applies to the current shell, so if you run ulimit in a shell and start node in another, that limit won't apply. |
We ran the whole process in the shell where limit was raised 3000 (actually, it was 3000 through .bash_profile, and fresh shells were used). In any case, I guess it really is out of the hands of libuv... I'll close the issue and pursue my dreams elsewhere ;) I made an issue over at the Webpack project. We'll see if we can make any progress going from that angle. |
Okidoki! Just to discard culprints, you could try the following: create a test which creates a directory and 1000 files insise. Then create a watcher for each with fs.watchFile, and see what happens. |
Also, make sure you use a Node version which has libuv >= 1.7.0, which includes this patch: 7980f13 |
I used latest Node with #641 merged into it, and the problem didn't go away, so I guess that patch was also a part of it. Over the weekend I explored an alternative for Webpack builds that gives us the same speed, but doesn't require watchers (build-on-demand with caching), so the team is happy again. I'll create the test you ask for and see if I can replicate the issue though. |
Well, I wrote a little test that watches thousands of files and folders, and can't get it to blow up... Not even with stock Node :-/ |
@ronkorving Oh. I'll tentatively close this then, since there is nothing we can do. If you manage to narrow it down, leave a comment and we can reopen it. |
Sounds good. |
We are running a fairly large project with 922 JavaScript and .less files being watched by Webpack's watch function on OS X (10.10.2) running on Node.js 5.2.0. During the initial build, or right when it's done with that, the following happens:
I wonder if this may be related to #387 and we are simply hitting maximum open files limitations. Any other ideas I'm also open to, because this is a massive blocker in our development process and is affecting multiple people at once.
The text was updated successfully, but these errors were encountered: