-
Notifications
You must be signed in to change notification settings - Fork 774
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.move fails with chmod error when disk under heavy use #357
Comments
Does this same problem happen with [email protected]? |
I'll try this evening and report back. Is there a specific v1 release you'd like me to try? |
Thank you! Anything before 2.0.0 is fine, I'm just trying to figure out if there was a regression introduced by 2.0.0 Also, which version of Node are you using? |
I'm using Node 7.5.0. It's probably not a regression but more of a continuation of an existing issue. |
Agreed. Although I just wanted to cross it off my list (if everyone said they were using 7.5.x then that may be suspect). |
@jdalton what does this mean? Since you say a "few" files and "large" directory, are you saying the files are of a large size (hence, large directory)? |
Yes. You can probably mimic the scenario with a folder containing a VM image and a readme.md. |
Using the current version
const fs = require('fs-extra')
const pify = require('pify')
const binary = (func) => (a, b) => func(a, b)
const move = binary(pify(fs.move))
// on Ubuntu 16.04.1
const src = 'src'
const dest = 'dest/newsrc'
// On Windows 10
const src = 'E:\\src'
const dest = 'G:\\dest\\newsrc'
move(src, dest).then(() => {
console.log('finished successfully.')
}).catch(err => {
console.log(err)
}) on both Ubuntu 16.04.1 intel core i7 and Windows 10 powershell on virtualbox and the move operation finished without any problems! So @jdalton would you please elaborate a little more on your case like the system you are using and exactly how large your |
@manidlou It's a flavor of Linux on a nas. The issue seems to happen more if I periodically scan the same folder for changes (like say every couple of minutes) in other active scripts. You might move the log file into the same folder as the vdi's though your setup looks representative. |
Alright, here is my guess. I think the issue comes from the fact that in From the https://nodejs.org/api/stream.html#stream_class_stream_writable docs:
and
Furthermore, If we look at https://github.com/AvianFlu/ncp/blob/master/lib/ncp.js#L127, they use So, I will fix that and hope that will solve your issue @jdalton. In the meantime, everyone is welcome to bring their ideas about this. |
Thanks for looking into this @manidlou! We've gone full-circle as #327 (changed @jdalton would you be willing to modify the installed @nicks would love your input here as well on the problems that you experienced. |
I agree that the If you look at the NodeJS source code, it's pretty easy to see that i wonder if there's an underlying bug in libuv that affects the network storage that @jdalton is using. Are you only able to repro on the nas? |
Sure thing!
The nas is the scenario where I spotted the issue. However, Node is running on the nas too, so it's not crossing any network boundaries or anything like that. Is there any reason deferring to the OS's |
@jdalton This package does use |
@nicks can you point out the |
@jdalton as @nicks pointed out, |
@jdalton fs-extra uses @manidlou We don't use node-mv as a dependency; @jdalton We don't want to shell out to
|
Very true. My bad! I should've mentioned that is a fork and not a dependency 😁! |
I'm seeing the error more when I change |
@jdalton, thanks for your feedback. as @nicks mentioned:
|
I've stopped periodically scanning the folder a bit up the thread. Update: As a workaround, since the error is Looking at lib/copy/ncp.js it looks like an off-by-one error could easily slip in. I think using async await and trasnspiling back with Babel and something like fast-async would help here. |
I'm closing this because after monitoring it some more it looks like what I was seeing may have been caused by checking a file's stat after it had been moved. So checking the old path which no longer exists. I was thrown off because the error messages are the same. A rewrite or async await use couldn't hurt though so 👍 on #374. |
@jdalton thanks for checking back to let us know!! Much appreciated. |
Using fs-extra v2.0.0 I noticed that
fs.move
, which uses/lib/copy/ncp
under the hood, fails with achmod
error when the disk is under heavy use.In this case I'm moving a very large directory of a few files.
I'm using pify on
fs.move
:With this error on the move operation what ends up happening is that
path-a
will still exist with one or so of its files left butpath-b
is created and contains all files (at least it contains a copy of the file remaining inpath-a
).Related to #326. \cc @nicks.
The text was updated successfully, but these errors were encountered: