-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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.copyFileSync hangs for file created within same layer in overlay filesystem #40200
Comments
This is reproducible on a regular Linux host as well. This happens specifically when using |
@Trott does it make sense to transfer this to the regular node issue tracker? |
I think so. (And if not, we can transfer it back.) Transferring.... |
@nodejs/fs |
I'm encountering this issue as well. Is there any way to work around it for now? I tried not using fs.copyFileSync, but the build tool I'm using seems to use it as well and I can't change that. Edit: It works on Ubuntu 18.04! |
Is everyone that is experiencing this on a Linux host or in a Linux container? I'm trying to replicate on macOS without docker and I can't seem to do it. |
I feel like this is related to Docker (and/or the overlay file system). I encountered the issue in my GitHub Workflow to build a container for Docker. After switching to Ubuntu 18.04, without any other changes, it worked again. |
yes I believe this is specific to overlay filesystems - I've updated the title accordingly |
@nodejs/fs @nodejs/docker Is anyone able to debug this to figure out if the issue is in Node.js core or libuv or docker or this is not-intuitive-but-working-as-expected or something else? |
This is almost certainly a libuv issue. |
@nodejs/libuv |
Given that Node freezes, I think that there might be an issue with the while loop here in libuv (maybe a race condition?): https://github.com/nodejs/node/blob/master/deps/uv/src/unix/fs.c#L1326 I'm not very familiar with the code, and sadly couldn't reproduce it locally - but I think I can think of two issues that might happen here. There's a race condition where the size of the file somehow changes and I think that this is the parallel code for Windows, it's a bit different and does check if it's non-negative and also checks if it has |
I experienced the same issue copying from I can give more information if needed.
|
one command repro: what's particularly interesting in the repo is that i do @dpchamps did an strace and found an infinite loop in there, he can add the deets
i believe this is what we observe w/ strace |
After digging into this issue to a pretty deep extent, I'm not sure it's a nodejs or libuv bug (initially, I was convinced it was 😅 ). Here's my notes and some reproducible examples that have nothing to do with node: https://github.com/dpchamps/sendfile-overlay-bug-repro. Something at the It might be helpful to the node/libuv devs to recap what I discovered here in this thread:
I'm not really sure what you might do at the libuv level to preempt this, but it's worth pointing out that
|
We started seeing this after a node update that pulled in the changes that moved Digging in a bit more, we're seeing it in It looks like Docker has been tracking this issue here: docker/for-linux#1015 And it looks like this was a kernel bug in certain 5.x kernels, and is being tracked here: https://lore.kernel.org/stable/Yanx6KobwiQoBQfU@kroah.com/ |
It seems this was already fixed in the kernel. |
Environment
Expected Behavior
See repro here. In the Dockerfile there, I copy a file with
cp
and then try to copy the same file again withfs.copyFileSync
. I expect this to work anddocker build .
to succeed.Current Behavior
docker build .
hangs indefinitely.The same issue applies to
fs.copyFile
andfs.promises.copyFile
.Possible Solution
Don't know
Steps to Reproduce
See https://github.com/joe-barnett/node-docker-issue
On macOS:
The text was updated successfully, but these errors were encountered: