Skip to content

EMFILE: too many open files #146

@rperryng

Description

@rperryng

Hey there,

I'm trying to use node-folder-hash as a means of validating whether the $(yarn cache dir) folder gets modified after restoring this cache folder (in CI) and running yarn install, so that I can avoid re-saving the (large) cache folder if it's unchanged. However, I ran into this error EMFILE: too many open files error. I was able to reproduce this locally by running hashElement on a folder that contains 200 copies of expressJS

Error: EMFILE: too many open files, scandir 'express-146/node_modules/fast-json-stable-stringify/.github'

From reading the source code, I see that hashElement is pre-configured to use graceful-fs, and graceful-fs apparently deals with EMFILE: too many open files by queueing/retrying readdir calls when EMFILE is encountered.

Could this be an issue with the way node-folder-hash is using graceful-fs? The only caveat I see in their docs is that the asynchronous APIs must be used to get these benefits, but it seems only the fs.promises module is used so I would think it should be ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions