grunt-istanbul icon indicating copy to clipboard operation
grunt-istanbul copied to clipboard

Error: EMFILE, too many open files

Open linusthe3rd opened this issue 10 years ago • 3 comments

I have a large JS project whose files I am trying to instrument. When I try to run "grunt instrument" with the following config:

instrument: {
    files: 'src/js/**/*.js',
    options: {
                lazy: true,
                basePath: 'target/coverage/instrument/'
            }
}

I get the following error:

Fatal error: An error occurred in an async call.
cause stack is ...
  Error: EMFILE, open 'src/js/lib/cultures/globalize.culture.hi.js'
async call history is ...
 [ { function: 'readFile',
    location: '/Users/jryding/Development/pure-cloud-browser-app/node_modules/grunt-istanbul/tasks/helpers.js:65:44',
    mapping: 
     { name: 'src/js/lib/cultures/globalize.culture.hi.js',
       code: [Object] } } ]

linusthe3rd avatar Jun 02 '14 14:06 linusthe3rd

Looking at a similar issue in the istanbul project, the problem there was that the code was asynchronously loading all of the files to run the action against them.

Digging into the error above at helpers.js:65, it looks like that line is also using an async call to load the files we want to instrument.

linusthe3rd avatar Jun 02 '14 14:06 linusthe3rd

How many files do you want to instrument?

100? 1000? 10000 or more?

taichi avatar Jun 03 '14 01:06 taichi

If i don't ignore ANY files, my project has just over 1000 files to instrument. Ignoring some files (e.g. lib/) bring it down to 600-800 files.

I expect this to grow over time.

linusthe3rd avatar Jun 11 '14 17:06 linusthe3rd