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

ENOENT: no such file or directory - version 1.6.0 on CentOS 6.5 #514

Closed
EarthCitizen opened this issue Jul 27, 2016 · 7 comments
Closed

Comments

@EarthCitizen
Copy link

I am having problems (files not getting processed) with version 1.6.0 on CentOS 6.5. I added some logging to FSWatcher._handleError to try to see what is happening, and I that is when I got this:

ENOENT: no such file or directory, stat 'my/file/foo.bar'

I do not have any issues at all on OS X. Everything works fine, but when executing the same code on CentOS, the above error.

I am still trying to track down exactly the place where the error is emitted. So, any suggestions to help speed up this process would be a big help.

@EarthCitizen EarthCitizen changed the title ENOENT: no such file or directory - version 1.6.0 ENOENT: no such file or directory - version 1.6.0 on CentOS 6.5 Jul 27, 2016
@es128
Copy link
Contributor

es128 commented Jul 27, 2016

The error tells you it's happening at some point where chokidar attempts to call fs.stat on that path. Does the file exist? Is it changing/moving around at the time (possible race condition)?

Adding a listener to the raw event may help you see what's happening.

I added some logging to FSWatcher._handleError

Why do that instead of adding a listener to the error event chokidar emits?

@EarthCitizen
Copy link
Author

I was just grasping at straws to try to figure out what is going on, so that is the reason for the logging in handle error.

My use case is that karma remap instanbul is using this project and adds a listener to the add event. In OS X the add event is emitted, and on Cent OS not.

I will keep digging to see what I can find.

@EarthCitizen
Copy link
Author

Here is the way that karma-remap-istanbul is using chokidar:

var watcher = chokidar.watch(sources, {
  awaitWriteFinish: {
    stabilityThreshold: 500,
    pollInterval: 100
  }
}).on('add', function (path) {
  addedPaths++;
  clearTimeout(noMoreFilesTimeout);

  if (addedPaths >= sourcesCount) {
    remap(watcher);
  } else {
    noMoreFilesTimeout = setTimeout(function () {
      log.warn('Not all files specified in sources could be found, continue with partial remapping.');
      remap(watcher);
    }, timeoutNoMoreFiles);
  }
});

setTimeout(function () {
if (addedPaths === 0) {
pendingReport--;
watcher.close();
log.warn('Could not find any specified files, exiting without doing anything.');
reportFinished();
}
}, timeoutNotCreated);

This is actually using chokidar 1.5.x, but even when I pushed karma-remap-istanbul to version 1.6.0, I had the same issue.

Anyhow, on OS X this is working fine. On CentOS however, it is timing out and displays the message 'Could not find any specified files, exiting without doing anything.' The interesting thing is that when you look at the timestamp of the file it is watching for, it IS created before the timestamp of the log.warn.

I don't want to rule out yet that the issue could be with karma-remap-istanbul, but it seems unlikely. I have tried this on two different CentOS 6.5 boxes and got the same result on both of them.

Thoughts?

@es128
Copy link
Contributor

es128 commented Jul 28, 2016

look at the timestamp of the file it is watching for, it IS created before the timestamp of the log.warn

The impression I get is that between the use of awaitWriteFinish and the timeout this setup looks very prone to race conditions. Underlying watch methods are different on each OS and performance may vary. If you can increase the setting for timeoutNotCreated, perhaps you can give that a try. But that's an educated guess at best, not enough has been described so far in terms of the actual sequence of actions that expose the problem (when files are created, when the watcher is instantiated, what shows up out of the raw event).

Unless this can be boiled down to a much simpler reproducible case it looks like more of an implementation problem than an indication of a bug/issue in chokidar. As you learn more I'll keep trying to give advice if I can, but going to close the issue for now.

@es128 es128 closed this as completed Jul 28, 2016
@EarthCitizen
Copy link
Author

I also tried changing his timeoutNotCreated to 20 seconds. But still had the problem. What is your recommendation for the settings he is passing to chokidar?

@es128
Copy link
Contributor

es128 commented Jul 28, 2016

I don't know nearly enough about the use case to make a recommendation.

@EarthCitizen
Copy link
Author

All of the unit tests pass on CentOS, FYI.

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