-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Invalid layer content in rootless mode #2381
Comments
@AkihiroSuda I guess this is the fuse-overlay? Seems it doesn't invalidate the fuse cache or writeback is not implemented correctly. edit: or is it the opaque handling? I initially looked that files where not there after clone but the issue seems to be that layer removes files and adds some new ones but in the next layer both appear. |
@giuseppe Is this something known/tracked for fuse-overlayfs? |
It could be fuse-overlayfs. What version of fuse-overlayfs is it? What is the underlying file system? Is it running on top of an another overlay mount? |
|
I am not sure I've followed the correct steps, but I've tried a simple
fuse-overlays is not even installed on the system. |
@giuseppe we run the rootless buildkitd in a kubernetes pod with no specific mounts so the underlying fs for builds is the root fs of the container (overlay) |
@AkihiroSuda moving to the native snapshotter solved all our problems with invalid layers but we took a huge hit in terms of performance (io throughput is much higher). I assume that's expected and that it is the only impact we should see from using this snapshotter? |
We checked on our side and we are not using fuse-overlay (we don't load the fuse module and we don't run the k8s-hostdev-plugin plugin: #1384) |
I'm not 100% sure but I think I may have found the (or a) problem. I simulated what happens directly on a linux host:
At this point,
And here is what we get in
Which is the expected content.
No whiteouts, let's look at the directory:
=> Directory is marked as opaque and the lower directory is ignored Let's do the same in a user namespace, starting from scratch:
At this point everything is the same, but
returns nothing in the userns. The directory has the right xattr in the host user namespace ( So, I think the problem is with the extended attribute: given it's part of the |
There is a solution in 5.11: torvalds/linux@2d2f2d7 And it looks promising:
Same as before, with the additional mount option from 5.11: And as a result:
Now I wonder if this will work with the overlay snapshotter because the new mount option is explicit and only work on 5.11+ kernels. We'll update our buildkit platform to 5.11 and will let you know what we find. |
I'm not sure what happens between 2 RUN commands in buildkit. Are we archiving the diff into a tarball before processing to next one? (this seems to rely on github.com/docker/docker/pkg/archive ) Slightly related: #2181 computes diff from the overlayfs upper dir (which requires |
No. Just the previous upper becomes an additional lower. @AkihiroSuda If the issue is that overlay in rootless mode doesn't work correctly for <5.11 kernels (at least for ubuntu) we should try to detect it and run fuse for these as well. cc @ktock for the overlay differ part |
This means we do not go through the Differ or Archiver ? Looks like I have another code path to explore. So we are unmounting and remounting using upper as an additional lower directly? (I wonder because I feel this should work, unless we do a copy, which may lead to loss of the xattr). I can easily check this on a 5.8 host |
Differ only runs at the end of the build if an image result was needed. |
OK I confirm this is the problem on 5.8:
At this point, merged has the right content and xattr does not show in userns:
If we proceed with a new mount including upper as an additional layer:
the content becomes wrong, showing the xattr is ignored for the second mount:
On 5.11, this works completely fine (as long as |
I confirm that the problem disappears with Ubuntu 20.04.3 and kernel 5.11 , which is great news 🎉 |
I just noticed we have a lot of
in our kernel logs. |
Hello,
We are starting to run buildkit in rootless mode and in some cases, we seem to be having issues with the snapshotter.
For instance, with this Dockerfile
We get this with buildkit in rootless mode:
Of course we'd expect content of the layer at step
#8
to be the same as the content at the end of step#7
We tested building in non-rootless mode and the problem disappeared.
After looking into past issues, we found #1792 which felt a bit similar, so we tried in rootless mode with
--oci-worker-snapshotter=native
and the problem also disappeared.So the problem only happens in rootless mode with overlayfs snapshotter.
Here is the configuration where we see this behavior:
--oci-worker-no-process-sandbox
Is there a way to diagnose what is failing when we use the overlayfs snapshotter?
I could not find the impact of using the native snapshotter instead of the overlayfs one. I assume slower build?
Of course, we are more than happy to perform additional tests to gather more data
The text was updated successfully, but these errors were encountered: