8000 Don't silently ignore errors determining size in TryReuseBlob by mtrmac · Pull Request #2709 · containers/image · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Don't silently ignore errors determining size in TryReuseBlob #2709

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

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

mtrmac
Copy link
Collaborator
@mtrmac mtrmac commented Feb 6, 2025

Returning the size required by the TryReuseBlob/PutBlob API; otherwise we could put -1 into manifests.

  • When looking for inexact matches, this will cause the matches to be skipped.
  • When checking for an exact match, this will cause an upload failure; we don't have any other way to handle pre-existing blobs on the destination.

For now, completely untested.

Copy link
Collaborator Author
@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Notes to self:

@mtrmac mtrmac marked this pull request as ready for review February 17, 2025 17:58
@mtrmac mtrmac force-pushed the content-length branch 2 times, most recently from 2a3536a to 50a8bb2 Compare February 17, 2025 18:28
@mtrmac mtrmac force-pushed the content-length branch 2 times, most recently from e7a85f9 to 683e3b9 Compare March 4, 2025 18:46
@mtrmac mtrmac added the kind/bug A defect in an existing functionality (or a PR fixing it) label Mar 4, 2025

size, err := getBlobSize(resp)
if err != nil {
size = -1
Copy link
Member

Choose a reason for hiding this comment

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

Should we at least logrus.Debug the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In both cases, GetBlob is explicitly allowed to return -1, so we wouldn’t expect users to need to diagnose why this is happening. Typically, the size is only used to sanity-check sizes of uploads, but the digest verification should serve the same purpose anyway.

The only adverse effect I could find is that writes to docker-daemon or docker-archive might need to store a file to disk if the size is unknown, and the input is uncompressed (if the input is compressed, the transports need to store it to disk in either case).

I don’t think this is really worth worrying about, and probably not worth the log noise, but I don’t feel strongly about this at all.

blobSize := getBlobSize(res)
blobSize, err := getBlobSize(res)
if err != nil {
blobSize = -1
Copy link
Member

Choose a reason for hiding this comment

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

logrus.Debug(err)?

@rhatdan
Copy link
Member
rhatdan commented Mar 11, 2025

LGTM

When looking for inexact matches, this will cause the matches to be skipped.
When checking for an exact match, this will cause an upload failure;
we don't have any other way to handle pre-existing blobs on the destination.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@mtrmac mtrmac merged commit d84dbab into containers:main Mar 11, 2025
10 checks passed
@mtrmac mtrmac deleted the content-length branch March 11, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A defect in an existing functionality (or a PR fixing it)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0