-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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.copyFile fails copying from nfs source to nfs dest file. #36439
Comments
@nodejs/libuv Reporter suspects the cited libuv change. |
@moqtadir The commit you refer to is in Node.js 14.9.0 but not 14.8.0. Are you able to test with those two versions to confirm that 14.8.0 does not exhibit the bug and 14.9.0 does? |
@Trott Apologize for the delay, not sure why I didn't get notified on your comments. Yes I can confirm issue doesn't happen on 14.8 but does on 14.9 - see below for all commands I ran to verify this.
|
|
@moqtadir , can you please try to compile and run this on your platform: #define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <stdio.h>
#include <errno.h>
#ifndef __NR_copy_file_range
#define __NR_copy_file_range (-1)
#endif
int main() {
int r = syscall(326, 4, 0, 5, 0, 1024, 0);
printf("r is %d, errno is %d, copy_file_range %d\n", r, errno, __NR_copy_file_range);
} |
Or maybe directly this replacing #define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef __NR_copy_file_range
#define __NR_copy_file_range (-1)
#endif
int main() {
int in = open("existing_nfs_file", O_RDONLY);
int out = open("new_nfs_file", O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
int r = syscall(326, in, 0, out, 0, 1, 0);
printf("in is %d, out is %d, r is %d, errno is %d, copy_file_range %d\n",
in, out, r, errno, __NR_copy_file_range);
} |
@mmomtchev The result is below
|
Also by the way, there was a similar issue in golang and they basically added exception for ENOTSUPP in addition to EINVAL because a copyfilerange on an NFS mount can return ENOTSUP. |
@moqtadir , yes precisely, this is the problem and the right solution |
Is there a workaround for this? I'm unclear on the timeline on how long it will take for that libuv fix to be released |
I don't have a workaround to suggest but a fix has landed in the libuv code base but has not yet made it into a release. Should be in the next libuv release I imagine, though. |
You can use require('child_process').spawnSync('/bin/cp', ['-bf', fromFile, toFile], { stdio: 'ignore' }) |
The fix landed in AFAIK, the bug still exists in Node.js 14. |
- https://jenkins.renci.org/job/helx-ui/37/console - nodejs/node#36439 Upstream node fix due in next LTS release, but this is blocking builds. Rolling back to version 12 maintenance LTS https://nodejs.org/en/about/releases/
Node.js 14.18.2 uses libuv 1.42.0. It is likely fixed. (If someone can test and confirm that it's fixed, that would be helpful.) Node.js 12.x is using 1.40.0 so I would expect it to still have this bug. |
Hmmm, but 12.x was reported as not susceptible initially. But maybe it is now because of updates? |
This was fixed a long time ago. |
When copying a file from nfs mount to the same nfs mount, fs.copyFileSync fails with ENOTSUP error.
This was not replicated in Node 12.x, but is reproducible consistently in node v14.15.1
To reproduce using 2 line test file
Using node 14.15.1 on CentOS 7 X86_64
And make sure /mnt/nfs_assets/ is an nfs4 mount.
I haven't researched this much, but the ifdef (linux) second was added recently and is now using the copyfile call but does not account for ENOTSUP being returned?
node/deps/uv/src/unix/fs.c
Line 904 in feab91a
Relevant commit.
cf34854
Please let me know if you need any additional information.
The text was updated successfully, but these errors were encountered: