Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

darwin: console.log() blows up when file descriptor limit is reached #7455

Closed
bnoordhuis opened this issue Apr 10, 2014 · 0 comments
Closed

Comments

@bnoordhuis
Copy link
Member

As does console.error().

var assert = require('assert');
var fs = require('fs');

if (process.platform === 'win32') {
  console.log('Skipping test, no RLIMIT_NOFILE on Windows.');
  return;
}

for (;;) {
  try {
    fs.openSync(__filename, 'r');
  } catch (e) {
    assert(e.code === 'EMFILE' || e.code === 'ENFILE');
    break;
  }
}

console.log('');  // Throws.
$ node emfile.js 
(libuv) Failed to create kqueue (24)
(libuv) Failed to create kqueue (24)

Error: write EBADF
    at errnoException (net.js:904:11)
    at WriteStream.Socket._write (net.js:645:26)
    at doWrite (_stream_writable.js:226:10)
    at writeOrBuffer (_stream_writable.js:216:5)
    at WriteStream.Writable.write (_stream_writable.js:183:11)
    at WriteStream.Socket.write (net.js:615:40)
    at Console.log (console.js:53:16)
    at Object.<anonymous> (/Users/bnoordhuis/emfile.js:23:9)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

That's not really helpful, especially if you want to log an error on how an operation failed because you hit the file descriptor limit...

Affects v0.10 and master.

/cc @indutny - libuv/node should allocate the shadow descriptors for fds 0-2 eagerly.

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

No branches or pull requests

3 participants