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

ENFILE: file table overflow with Karma #1979

Open
abhipanda opened this issue Mar 8, 2016 · 19 comments
Open

ENFILE: file table overflow with Karma #1979

abhipanda opened this issue Mar 8, 2016 · 19 comments

Comments

@abhipanda
Copy link

Hi Guys,

I am facing file table overflow issue while running the karma tests please help?

Details are mentioned here.

http://stackoverflow.com/questions/35873437/enfile-file-table-overflow-with-karma

Thanks,
Abhi

@abhipanda
Copy link
Author

This issue is getting serious as more people are reporting it and we have no idea how it happened.

[08:44:36] 'karma' errored after 2.48 s [08:44:36] Error: ENFILE: file table overflow, scandir '/Users/Abhi/Documents/projects/test/src/app' at Error (native) at Object.fs.readdirSync (fs.js:808:18) at GlobSync._readdir (/Users/Abhi/Documents/projects/test/node_modules/karma/node_modules/glob/sync.js:275:41) at GlobSync._processGlobStar (/Users/Abhi/Documents/projects/test/node_modules/karma/node_modules/glob/sync.js:330:22) at GlobSync._process (/Users/Abhi/Documents/projects/test/node_modules/karma/node_modules/glob/sync.js:128:10) at new GlobSync (/Users/Abhi/Documents/projects/test/node_modules/karma/node_modules/glob/sync.js:46:10) at new Glob (/Users/Abhi/Documents/projects/test/node_modules/karma/node_modules/glob/glob.js:111:12) at /Users/Abhi/Documents/projects/test/node_modules/karma/lib/file-list.js:161:14 at Array.map (native) at [object Object].List._refresh (/Users/Abhi/Documents/projects/test/node_modules/karma/lib/file-list.js:153:37) at [object Object].List.refresh (/Users/Abhi/Documents/projects/test/node_modules/karma/lib/file-list.js:252:27) at [object Object].Server._start (/Users/Abhi/Documents/projects/test/node_modules/karma/lib/server.js:177:12) at [object Object].invoke (/Users/Abhi/Documents/projects/test/node_modules/karma/node_modules/di/lib/injector.js:75:15) at [object Object].Server.start (/Users/Abhi/Documents/projects/test/node_modules/karma/lib/server.js:101:18) at Gulp. (/Users/Abhi/Documents/projects/test/gulp/tasks/test-unit.js:53:12) at module.exports (/Users/Abhi/Documents/projects/test/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) at Gulp.Orchestrator._runTask (/Users/Abhi/Documents/projects/test/node_modules/gulp/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/Users/Abhi/Documents/projects/test/node_modules/gulp/node_modules/orchestrator/index.js:214:10) at Gulp.Orchestrator.start (/Users/Abhi/Documents/projects/test/node_modules/gulp/node_modules/orchestrator/index.js:134:8) at /Users/Abhi/Documents/projects/test/node_modules/gulp/bin/gulp.js:129:20 at nextTickCallbackWith0Args (node.js:419:9) at process._tickCallback (node.js:348:13)

@dignifiedquire
Copy link
Member

I don't think this is an issue with karma directly, it might be an issue with node-glob (which is known to be quirky on windows). The problem is I as long as I don't have a way to reproduce this I'm not sure what to do.

@abhipanda
Copy link
Author

Thanks. Just FYI ... I am running on Mac OS X El Capitan

@dignifiedquire
Copy link
Member

Oh sorry, yes you are right, not sure why I thought it was Windows related...

From the looks it might be sth tod with the jspm plugin. Have you tried removing it/different versions?

@abhipanda
Copy link
Author

I tried updating JSPM doesn't work, was getting npm deprecation warning in console for graceful-fs if that is relevant.

npm install jspm
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
jspm@0.16.30 node_modules/jspm
├── graceful-fs@4.1.3
├── semver@5.1.0
├── ncp@2.0.0
├── jspm-registry@0.4.0 (graceful-fs@3.0.8, semver@4.3.6)
├── rsvp@3.2.1
├── proper-lockfile@1.1.2 (extend@3.0.0, err-code@1.1.1, retry@0.9.0)
├── chalk@1.1.1 (escape-string-regexp@1.0.5, supports-color@2.0.0, strip-ansi@3.0.1, has-ansi@2.0.0, ansi-styles@2.2.0)
├── glob@6.0.4 (path-is-absolute@1.0.0, inherits@2.0.1, once@1.3.3, inflight@1.0.4)
├── minimatch@3.0.0 (brace-expansion@1.1.3)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── rimraf@2.5.2 (glob@7.0.3)
├── liftoff@2.2.0 (extend@2.0.1, rechoir@0.6.2, flagged-respawn@0.3.1, findup-sync@0.3.0, resolve@1.1.7)
├── jspm-github@0.13.11 (netrc@0.1.4, graceful-fs@3.0.8, expand-tilde@1.2.0, yauzl@2.4.1, which@1.2.4, rimraf@2.3.4, request@2.53.0, tar@2.2.1)
├── uglify-js@2.6.2 (async@0.2.10, uglify-to-browserify@1.0.2, source-map@0.5.3, yargs@3.10.0)
├── traceur@0.0.95 (commander@2.6.0, semver@2.3.2, glob@4.3.5, source-map-support@0.2.10)
├── request@2.69.0 (aws-sign2@0.6.0, forever-agent@0.6.1, tunnel-agent@0.4.2, oauth-sign@0.8.1, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.2.1, node-uuid@1.4.7, qs@6.0.2, combined-stream@1.0.5, form-data@1.0.0-rc3, mime-types@2.1.10, aws4@1.3.2, hawk@3.1.3, bl@1.0.3, http-signature@1.1.1, har-validator@2.0.6)
├── jspm-npm@0.26.6 (graceful-fs@3.0.8, glob@5.0.15, which@1.2.4, rmdir@1.1.0, resolve@1.1.7, tar@1.0.3, request@2.58.0)
├── systemjs@0.19.23 (when@3.7.7, es6-module-loader@0.17.11)
├── core-js@1.2.6
└── systemjs-builder@0.15.10 (source-map@0.5.3, bluebird@3.3.4, rollup@0.25.4, traceur@0.0.102, es6-template-strings@2.0.0)

@kevcjones-archived
Copy link

Hey Guys, As Abhi will know, i too found myself in the same boat today, oddly, the only one in my team we found it hard to spot the cause, but can confirm that the globbing was indeed spurning the error message and annoyingly didn't seem to have anything to do with open file limits (walked that path for a while sigh).

Stack answer i shared with Abhi here

In the end the main cause seemed to be if i used a glob pattern in the karma.config which contained a double asterisk (*/) in a folder that went further than a second level deep.

Then managed to replicate the error by using the node-glob directly, to generate the same error.

In the end, using the glob.sync route, and building the URL array myself worked around the issue. Hopefully this gives the author a clue into what he can do to fix. Cheers

@playground
Copy link

+1

After upgrading to ng2 beta 11, I'm too getting these errors.

{ [Error: ENFILE: file table overflow, scandir '/Users/git_repo/src/app']
errno: -23,
code: 'ENFILE',
syscall: 'scandir',
path: '/Users/git_repo/src/app' }

@laurelnaiad
Copy link

I have them on beta 9 (Yosemite)

@fyodorvi
Copy link

@Bolza
Copy link

Bolza commented Apr 29, 2016

Any news on this?
I get the error on a directory that only contains 1 level and 3 files in it...

@said-abidi
Copy link

Any news on this issue? I have the same error. For information, I use MacOS 10.11.4.

@fyodorvi
Copy link

fyodorvi commented May 9, 2016

@Bolza @said-abidi

Run these in terminal:

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 65536    

Add this to ~/.bash_profile

ulimit -n 65536 65536

That's it.

Source: http://blog.mact.me/2014/10/22/yosemite-upgrade-changes-open-file-limit

@jamie-pate
Copy link

jamie-pate commented Jun 30, 2016

Getting this on ubuntu linux 16.04 as well,

ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 63562
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 63562
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

Pre-globbing the files worked, but ulimit changes didn't.

@said-abidi
Copy link

Desactivate the cache for karma solved this issue (nocache = true in karma conf), but break the coverage using karma. Is there any way to solve this issue whitout increasing ulimit (we should not need it) and still use the cache?

@elie222
Copy link

elie222 commented Nov 15, 2016

sudo launchctl limit maxfiles 16384 16384 && ulimit -n 16384 did it for me. I don't use Karma, but had similar issues with mup and the most recent Meteor release and packages I was using.

@SachaG
Copy link

SachaG commented Jan 13, 2017

Cross-posting this here because it might help others, here's a solution to this issue by @abernix:

https://gist.github.com/abernix/a7619b07b687bb97ab573b0dc30928a0

@JennieJi
Copy link

@elie222 saved me

@kof
Copy link

kof commented Jun 14, 2017

I have got a reproducible example for this issue, wanna see?

@subodhk01
Copy link

@Bolza @said-abidi

Run these in terminal:

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 65536    

Add this to ~/.bash_profile

ulimit -n 65536 65536

That's it.

Source: http://blog.mact.me/2014/10/22/yosemite-upgrade-changes-open-file-limit

Thanks! Worked for me.

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

No branches or pull requests