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

Unexpected file 'change' events on directory creation. #499

Closed
arubtsov opened this issue Jun 15, 2016 · 6 comments
Closed

Unexpected file 'change' events on directory creation. #499

arubtsov opened this issue Jun 15, 2016 · 6 comments

Comments

@arubtsov
Copy link

I'm on Windows 8.1 x64, node v4.4.5 \ v.6.1.0 , Chokidar 1.5.2.
Problem occurs only on Win platform.

When creating a directory, 'change' events fire for files (at the same level) whose paths include the path to created directory.

For example, if you create "name" directory in a folder which contains "name.js", 'change' event for "name.js" will be fired.

https://gist.github.com/arubtsov/7c42600ab9f2c69791c400a130404b26

@UltCombo
Copy link

The same problem has been reported here: floatdrop/gulp-watch#236

I can also reproduce the issue in Windows 10:

Chokidar bug

require('chokidar').watch('.', { ignoreInitial: true }).on('all', (event, path) => {
  console.log(event, path);
});

@es128
Copy link
Contributor

es128 commented Jun 20, 2016

These events are being reported by node core fs.watch (you can see by listening to the raw event). Not sure what workarounds might be possible, it's difficult to doubt/verify change events coming from the underlying watch methods.

Using usePolling: true may be one workaround, although not recommended for many cases because it has other drawbacks.

@UltCombo
Copy link

So, it is actually a bug in the Node core then? Do we already have a bug reported there?

@es128
Copy link
Contributor

es128 commented Jun 20, 2016

I don't know whether there's currently an open issue about this behavior, and I am also unsure whether the issue can be fixed in node, or whether it's actually deeper down in the ReadDirectoryChangesW windows api.

The starting point would be to modify the repro script to show it happening with just fs.watch directly. I don't have a windows environment to work/test with currently.

@UltCombo
Copy link

Looks like this is a known issue in libuv.
nodejs/node-v0.x-archive#25689
#420
nodejs/node#4351
I believe all these issues should be fixed by libuv/libuv#682

@es128
Copy link
Contributor

es128 commented Jun 21, 2016

Ah, right ok so this is the same as #420. Will close this one as a dupe then and keep tracking it there. Unfortunately it still seems there is no solution that can be accomplished within chokidar.

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

3 participants