node-graceful-fs: Win 10 pro still getting `EMFILE: too many open files` error.

I’ve added this at the root of my app

var realFs = require('fs')
var gracefulFs = require('graceful-fs')
gracefulFs.gracefulify(realFs)

But I’m still getting EMFILE: too many open files error.

Any ideas what else can I do? Win 10 pro

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 24

Most upvoted comments

As I investigated error is thrown by fs.openSync which is not patched by graceful-fs, and there seems no way it can work without patching as by looking at the source code of fs.openSync the error comes from native binding.

function openSync(path, flags, mode) {
  path = getValidatedPath(path);
  const flagsNumber = stringToFlags(flags);
  mode = parseFileMode(mode, 'mode', 0o666);

  const ctx = { path };
  const result = binding.open(pathModule.toNamespacedPath(path),
                              flagsNumber, mode,
                              undefined, ctx);
  handleErrorFromBinding(ctx);
  return result;
}

So it looks as clear bug on graceful-fs side. @isaacs ?