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

fs.copy fails with chmod error when disk under heavy use #326

Closed
nicks opened this issue Dec 20, 2016 · 5 comments
Closed

fs.copy fails with chmod error when disk under heavy use #326

nicks opened this issue Dec 20, 2016 · 5 comments

Comments

@nicks
Copy link
Contributor

nicks commented Dec 20, 2016

Sometimes, when the disk is under heavy use, we see fs.copy fail with the following error:

[Error] ENOENT: no such file or directory, chmod '/path/to/dir.js'

We tracked down the error to this line: https://github.com/jprichardson/node-fs-extra/blob/1.x/lib/copy/ncp.js#L111

    writeStream.once('finish', function () {
      fs.chmod(target, file.mode, function (err) {
        if (err) return onError(err)

My current hypothesis is that the stream finish event is just for generic stream flush, and doesn't guarantee that the underlying filesystem operations have completed. If I change it to 'close', the issue goes away.

That said, I've very vague on the intended semantics of nodejs stream events, so I might be on the totally wrong path here.

@jprichardson
Copy link
Owner

I believe you are correct. Feel like submitting a PR? We'll be releasing 2.0 after Jan 1st and this would make in time for that release.

@nicks
Copy link
Contributor Author

nicks commented Dec 20, 2016

OK

nicks pushed a commit to Medium/node-fs-extra that referenced this issue Dec 20, 2016
nicks pushed a commit to Medium/node-fs-extra that referenced this issue Dec 20, 2016
nicks pushed a commit to Medium/node-fs-extra that referenced this issue Dec 20, 2016
nicks pushed a commit to Medium/node-fs-extra that referenced this issue Dec 21, 2016
@RyanZim RyanZim added this to the 2.0.0 milestone Dec 24, 2016
@RyanZim
Copy link
Collaborator

RyanZim commented Dec 26, 2016

Fixed in #327 (Thanks @nicks!). Should be released early next year.

@RyanZim RyanZim closed this as completed Dec 26, 2016
bluelovers added a commit to bluelovers/node-fs-extra that referenced this issue Jan 9, 2017
* master: (687 commits)
  Add fs-promise as fs-extra-promise alternative
  Move klaw to devDeps
  Remove walk() & walkSync()
  Refactor move() tests
  Cleanup lib/move/index.js
  Rename clobber to overwrite
  BREAKING: Drop Node v0.10 & io.js support
  BREAKING: Do not error when copy destination exists & clobber: false
  Use writeStream 'finish' event instead of 'close'. Fixes jprichardson#326
  copySync() should apply filter to directories like copy()
  lib/walk-sync: enhance walkSync to return path and stats
  Adding copy sync test for src file without write perms
  Fix remove() no-globbing tests to skip/pass on Windows
  Test that remove() ignores glob characters.
  Remove move()'s broken limit option
  Fix move clobber tests to work around graceful-fs bug.
  Fix incorrect anchor link
  README: Node v0.12 deprecation notice.
  1.0.0
  CHANGELOG: add issues
  ...
bluelovers added a commit to bluelovers/node-fs-extra that referenced this issue Jan 9, 2017
* develop: (43 commits)
  Add fs-promise as fs-extra-promise alternative
  Move klaw to devDeps
  Remove walk() & walkSync()
  Refactor move() tests
  Cleanup lib/move/index.js
  Rename clobber to overwrite
  BREAKING: Drop Node v0.10 & io.js support
  BREAKING: Do not error when copy destination exists & clobber: false
  Use writeStream 'finish' event instead of 'close'. Fixes jprichardson#326
  copySync() should apply filter to directories like copy()
  lib/walk-sync: enhance walkSync to return path and stats
  Adding copy sync test for src file without write perms
  Fix remove() no-globbing tests to skip/pass on Windows
  Test that remove() ignores glob characters.
  Remove move()'s broken limit option
  Fix move clobber tests to work around graceful-fs bug.
  Fix incorrect anchor link
  README: Node v0.12 deprecation notice.
  1.0.0
  CHANGELOG: add issues
  ...
@popod
Copy link

popod commented Feb 7, 2017

It seem that this error occurs always on 2.0.0 :(

error

@RyanZim
Copy link
Collaborator

RyanZim commented Feb 7, 2017

@popod If this issue still exists, please open a new issue with a minimal, complete, and verifiable example. Thanks!

Repository owner locked and limited conversation to collaborators Feb 7, 2017
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

4 participants