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

Fix: archive/tar: write too long error when using Docker Desktop containerd backend #275

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

natalieparellano
Copy link
Member

Fixes (in part) buildpacks/pack#2174

This is somewhat of a band-aid solution and degrades performance because we have to read the uncompressed layer bits to get the uncompressed layer size for layers that we docker save out of the daemon (re-used layers and all the base layers).

The better longer-term fix will be to send OCI-layout formatted tars when we have all the layers available (when using containerd as the backing store, this will always be true).

…ntainerd backend

Fixes buildpacks/pack#2174

This is somewhat of a band-aid solution and degrades performance
because we have to read the uncompressed layer bits to get the uncompressed layer size
for layers that we `docker save` out of the daemon (re-used layers and all the base layers).

The better longer-term fix will be to send OCI-layout formatted tars
when we have all the layers available (when using containerd as the backing store, this will always be true).

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano requested a review from a team as a code owner May 31, 2024 19:57
if err != nil {
return err
}
return i.AddLayerWithHistory(layer, emptyHistory)
}

func calculateChecksum(path string) (string, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function relies on the daemon always outputting uncompressed layers, which is no longer true

}
if fileSize == compressedSize {
// the layer is compressed, we don't know the uncompressed size
uncompressedSize = -1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real fix

@@ -288,11 +289,13 @@ func (s *Store) getLayerSize(layer v1.Layer) (int64, error) {
return 0, err
}
knownLayer, layerFound := s.onDiskLayersByDiffID[diffID]
if layerFound {
if layerFound && knownLayer.uncompressedSize != -1 {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real fix

Copy link
Member

@jjbustamante jjbustamante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a unit test for this? or do we need docker 25 in the runner to be able to test it?

@natalieparellano
Copy link
Member Author

do we need docker 25 in the runner to be able to test it?

Yeah, we need it. And, containerd should be enabled as the backing storage. It's a bit of a mess.

@natalieparellano natalieparellano merged commit 47db70c into main Jun 3, 2024
3 checks passed
@natalieparellano natalieparellano deleted the fix/archive-write-too-long-part-1 branch June 3, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants