persistent option ignored by #2293

eladb opened this Issue Dec 8, 2011 · 8 comments


None yet

4 participants

eladb commented Dec 8, 2011 seem to be broken on mac.
This script (named j.js) does not exit.

var fs = require('fs');'j.js', { persistent: false }, function() {

P.S. fs.watchFile is working.




What is? {persistent:false} should work but doesn't.


Sorry. I didn't notice the persistent false somehow.

ghost commented Dec 14, 2011

I have this error as well on my Mac. It doesn't respond to a change.


Could someone please change the issue title to something more specific, like "persistent option ignored by under OS X"?


Updated. It's not specific to OS X, by the way.


This bug is a manifestation of a design flaw in the UNIX part of libuv. It's quite fixable, we just need to decide on the best approach.

The event loop maintains a reference count of active handles. Setting {persistent:false} makes Node drop the reference count by one but it turns out that some handle types - including uv_fs_event_t - are counted twice, hence the event loop remains alive.

@bnoordhuis bnoordhuis added a commit that referenced this issue Jan 2, 2012
@bnoordhuis bnoordhuis test: add #2293 regression test
Creating a file event watcher with{persistent:false}) should not block
the event loop.

Fixed in joyent/libuv@38fc6ad. The libuv that's bundled with node has been upgraded in 41f2725, a regression test has been added in 884f689.

@bnoordhuis bnoordhuis closed this Jan 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment