AmpersandJS / ampersand

Quickest way to get started with ampersand.
MIT License
812 stars 41 forks source link

Too Many file open error #117

Open chetandhembre opened 9 years ago

chetandhembre commented 9 years ago

Hi guys ,

I am using code fetch from here and I just upgraded to my packages to later versions.

After starting server I am getting following error

Debug: internal, implementation, error 
    Error: Uncaught error: EMFILE, too many open files
    at globalTr (/Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/index.js:546:43)
    at makeTransform (/Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/module-deps/index.js:250:21)
    at /Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/module-deps/index.js:225:9
    at Deps.getTransforms (/Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/module-deps/index.js:230:7)
    at /Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/module-deps/index.js:365:24
    at onresolve (/Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/module-deps/index.js:177:14)
    at /Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/index.js:475:13
    at /Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/browser-resolve/index.js:254:13
    at /Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/resolve/lib/async.js:44:21
    at ondir (/Users/chetandhembre/project/examples/hapi-hbs/node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/node_modules/resolve/lib/async.js:187:3

Can any one help me here ?

chetandhembre commented 9 years ago

Hey guys ,

I can reproduce bug.. And

at globalTr (node_modules/moonboots_hapi/node_modules/moonboots/node_modules/browserify/index.js:546:43)

This globalTr function is called multiple times in my case I tried to install dependencies freshly multiple times but problem is still persists.

fyockm commented 9 years ago

Try https://github.com/gruntjs/grunt/issues/788#issuecomment-18088252

chetandhembre commented 9 years ago

Yeah .. I tried increasing ulimit but it is not helping much.. After some request it is throwing EMFILE. I have one question why does browsify opening so much files (in my case 10480) ? I am testing this after I restarted my system. and only browser tabs are open (max 10).

Interestingly when i revert https://github.com/substack/node-resolve/commit/e83630d9769342a771903b60322c2c0de6325a92 commit all things looks fine.

Am I missing something here ?

prust commented 9 years ago

@chetandhembre: https://github.com/substack/node-browserify/issues/1003 also proposes increasing ulimit (to 2048), but if you're at 10480, then you'll need to go a lot higher. I'm not sure if that number of open files is excessive or expected.

At first I assumed it was excessive, given your report about it being far higher on the latest version of node-resolve, but after reading the issue that the latest version fixes (https://github.com/substack/node-resolve/issues/76), I realized it would be expected to be a lower number on the older (buggy) version.

Perhaps the best way to determine if it's a bug or not would be to examine the files that are open with and without the substack/node-resolve@e83630d commit (maybe this article is helpful? I'm guessing you have OSX, maybe the "Unix" instructions will work?)

Usually node packages will use https://github.com/isaacs/node-graceful-fs if they're running into EMFILE errors. It handles a number of things, but its primary purpose is "fs with incremental backoff on EMFILE". If the large number of files is expected, it could be that node-resolve needs to use node-graceful-fs to gracefully handle it.

chetandhembre commented 9 years ago

@prust thanks for such details response.. I will definitely use your suggestion. May be next weekend I will look into it again