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

3.0.3 regression on Node 0.10 #34

Closed
tschaub opened this issue Oct 14, 2014 · 1 comment
Closed

3.0.3 regression on Node 0.10 #34

tschaub opened this issue Oct 14, 2014 · 1 comment

Comments

@tschaub
Copy link

tschaub commented Oct 14, 2014

It looks like 34e473a (from #31) introduced an issue with Node 0.10.

Here is a script that reproduces the issue:

var fs = require('graceful-fs');

// first make some files
fs.mkdirSync('files');
var num = 333;
var paths = new Array(num);

for (var i = 0; i < num; ++i) {
  paths[i] = 'files/file-' + i;
  fs.writeFileSync(paths[i], 'content');
}

// now read them
var done = 0;
for (var i = 0; i < num; ++i) {
  fs.readFile(paths[i], function(err, data) {
    if (err) {
      console.error(err);
      process.exit(1);
    }
    ++done;
    if (done == num) {
      console.log('success');
    }
  });
}

With [email protected], this works on Node 0.11.13 and fails on 0.10.28.

$ rm -rf files/ && node test.js 
(libuv) Failed to create kqueue (24)
(libuv) Failed to create kqueue (24)

events.js:72
        throw er; // Unhandled 'error' event
              ^
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.warn (console.js:61:16)
    at /Users/tschaub/projects/emfile/test.js:18:15
    at fs.js:207:20
    at Object.oncomplete (fs.js:107:15)

With [email protected] (eval evil notwithstanding) this works on Node 0.11 and 0.10.

@isaacs
Copy link
Owner

isaacs commented Oct 14, 2014

Fixed on master and 3.0.4, with this script worked into a proper test.

Thanks. I guess we'll have to work out some other way around the evil of eval :)

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

No branches or pull requests

2 participants