Skip to content
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

[1.4.2.1] Error: ENFILE: file table overflow #8057

Closed
PolGuixe opened this issue Nov 15, 2016 · 16 comments
Closed

[1.4.2.1] Error: ENFILE: file table overflow #8057

PolGuixe opened this issue Nov 15, 2016 · 16 comments

Comments

@PolGuixe
Copy link

Every time I try to run meteor I am getting this type of error from different node_modules...

I just updated to 1.4.2.1 never happened with 1.4.2.

=> Started proxy.
=> Started MongoDB.
/Users/PolGuixe/.meteor/packages/coffeescript/.1.11.1_3.7g1l85++os+web.browser+web.cordova/plugin.compileCoffeescript.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:190
      throw error;
      ^

Error: ENFILE: file table overflow, scandir...
@johanbrook
Copy link

I was getting the same, after an upgrade to macOS Sierra. Turns out, macOS have a harsh limit on number of open files. I ran this, from here:

$ echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
$ echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -w kern.maxfiles=65536
$ sudo sysctl -w kern.maxfilesperproc=65536
$ ulimit -n 65536

@PolGuixe
Copy link
Author

@johanbrook Thanks! Solved!

@abernix
Copy link
Contributor

abernix commented Nov 17, 2016

I'm glad this is solving it for everyone. Unfortunately, Apple sets ridiculously low limits by default which might be good for some users, but is awful for developers.

For what it's worth, I would recommend setting the limit much much higher than 65536 (524288 is great).

Additionally, I would recommend using a method that doesn't modify /etc/ files directly since throughout the years Apple has randomly decided to stop loading these files (for example, it used to be a common recommendation to put this in /etc/launchd.conf, but that no longer works in Yosemite).

I have outlined a method which I believe works reliably from OS X 10.4 to 10.12 (current) in this Gist

@c9s
Copy link
Contributor

c9s commented Nov 30, 2016

There is anyone ever checked how many files that meteor build would open / watch ? why do we need such this high number like .. 524,288, It's actually very unusual to me.

@c9s
Copy link
Contributor

c9s commented Nov 30, 2016

If I upgraded meteor app to 1.4.2.3, this issue doesn't exist.

This is only for 1.4.2.1 on OS X 10.12.

This issue doesn't exist with 1.3.5.x on OS X 10.12.

And so I suspect there is something wrong in meteor 1.4.2.1

@abernix
Copy link
Contributor

abernix commented Dec 1, 2016

@c9s Meteor needs to be able to detect changes within your project and to do this it needs file watchers. If you have 20000 files in your project, then you need to be able to watch that many files. Of course you probably don't have 524,288 files and therefore Meteor probably doesn't need that many.

Unfortunately, the default maxfiles on Apple OSs is 256, which is low as a default. Other OSs are much much higher by default. I understand some reasoning for this but considering you're in a development machine the change above is saying, "Hey Apple, let me open more than 256 files on my fancy development hardware that can definitely support it."

If you're concerned about such a high number, use something smaller. If you want to monitor it, you should check out lsof.

Many other tools, such as Facebook's Watchman make similar recommendations (actually, even higher numbers).

@Maxhodges
Copy link
Contributor

Maxhodges commented Dec 11, 2016

@abernix thank you thank you thank you
sucks the error message provides no real help on this issue

@chip
Copy link

chip commented Jan 26, 2017

Thanks so much for the excellent instructions. I'm using 10.12.2 followed the instructions precisely, yet ulimit didn't report the number accurately. Instead, I had to manually set it like so:

ulimit -n 524288

HTH. Thanks again!

@VinZ73
Copy link

VinZ73 commented Sep 8, 2017

Having the same issue on MacBook Pro Sierra; Meteor 1.5.2, XCODE 8
Having Patched file limit issue with script above

But still getting promise_server error .... :-(((

App running at: http://localhost:3000/
=> Errors executing Cordova commands:

While running Cordova app for platform iOS with options --emulator:
Error: Command failed: /Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/run --emulator
TypeError: Cannot read property 'replace' of undefined
at remove (/Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/node_modules/ios-sim/src/lib.js:282:70)
at Array.forEach (native)
at Object.lib.getdevicetypes (/Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/node_modules/ios-sim/src/lib.js:292:22)
at Object.listEmulatorImages [as run] (/Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/lib/list-emulator-images:34:29)
at deployToSim (/Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/lib/run.js:173:50)
at /Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/lib/run.js:115:20
at _fulfilled (/Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/node_modules/q/q.js:796:13)
at /Users/vinzpro/Dev/Meteor/MyAdviserPro/MapV1/.meteor/local/cordova-build/platforms/ios/cordova/node_modules/q/q.js:604:44
at ChildProcess.exitCallback (/tools/utils/processes.js:151:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
=> awaited here:
at Function.Promise.await (/Users/vinzpro/.meteor/packages/templating-compiler/.1.3.2.1rz7f23++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:35:12)
at CordovaProject.runCommands (/tools/cordova/project.js:715:22)
at CordovaProject.run$ (/tools/cordova/project.js:261:10)
at tryCatch (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:63:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:337:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:96:21)
at tryCatch (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:63:40)
at invoke (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:139:20)
at /Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:184:11
at callInvokeWithMethodAndArg (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:183:16)
at AsyncIterator.enqueue (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:206:13)
at AsyncIterator.prototype.(anonymous function) [as next] (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:96:21)
at Object.runtime.async (/Users/vinzpro/.meteor/packages/meteor-tool/.1.5.2.9i7mdi++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/regenerator-runtime/runtime.js:226:14)
at /Users/vinzpro/.meteor/packages/templating-compiler/.1.3.2.1rz7f23++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:32:39

/Users/vinzpro/.meteor/packages/templating-compiler/.1.3.2.1rz7f23++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:190
throw error;
^

@klaussner
Copy link
Contributor

klaussner commented Sep 8, 2017

@VinZ73 This is a totally different issue because there is no "ENFILE: file table overflow" error in the stack trace you posted. I think that you encountered a bug in the ios-sim package that Meteor uses to run the iOS Simulator. Please open a new issue and I will respond there. Thanks! 😄

@arjun3396
Copy link

in MacOS catalina I'm getting error

sysctl: cannot stat /proc/sys/kern/maxfiles: No such file or directory

@ehaxhaj
Copy link

ehaxhaj commented Nov 5, 2019

@johanbrook Thanks, its work for me on macOS Catalina

@hinodi
Copy link

hinodi commented Mar 1, 2020

I was getting the same, after an upgrade to macOS Sierra. Turns out, macOS have a harsh limit on number of open files. I ran this, from here:

$ echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
$ echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -w kern.maxfiles=65536
$ sudo sysctl -w kern.maxfilesperproc=65536
$ ulimit -n 65536

thank you, you save my life 😄😄

@juliomac
Copy link

juliomac commented Sep 8, 2020

changing to 524288 did not work for me on a Macbook High Sierra after upgrading application from meteor 1.8.3 to 1.9.3.

@juliomac
Copy link

juliomac commented Sep 8, 2020

Error is: /Users/username/.meteor/packages/meteor-tool/.1.9.3.4dtuxq.ow2h++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node[63929]: ../src/node_contextify.cc:649:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfov8::Value &): Assertion `args[1]->IsString()' failed.
Abort trap: 6

@filipenevola
Copy link
Collaborator

Hi, if you are still having issues in new Meteor versions open a new issue.

If you change from a version of Meteor to another with Node.js changes maybe you want to remove your node_modules and meteor reset to clean up NPM compiled binaries.

@meteor meteor locked as resolved and limited conversation to collaborators Sep 9, 2020
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