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

Fall back from chunked pulls when the chunked metadata is too large #2230

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Jan 24, 2025

This is a short-term fix for containers/podman#24885 : if the chunked metadata is too large, trigger fallback to the traditional non-chunked pull path instead of a hard failure. See the linked issue for previous discussion.


RFC: While working on this, the APIs of various functions started looking increasingly unwieldy, so I started with a refactoring of the way chunkedDiffer is initialized, and the way read…Manifest return data. I think it’s a slight improvement, but it’s not at all an obvious improvement. I’d be happy to drop the initial refactor commits and to turn this into only the fallback logic.


This is a short-term mitigation of the existing limits. It seems that there are various other (close and not that close) code paths that can similarly allocate a large amount of memory, with, at least… inconsistent enforcement of limits.


Marked draft because I didn’t test the code yet.

@giuseppe PTAL

See individual commit messages for details.

Try to introduce at least _some_ structure and order to this
huge object.

Much more could probably be done.

For now, the comments are aspirational, documenting methods
that don't yet exist. That will be remedied soon.

Only reorders existing fields, should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
Instead of collecting all data in individual variables,
and only creating a fully-formed chunkedDiffer at the very end,
start with a newUninitializedDiffer with some values known
from the start, and fill out other parts in chunkedDiffer.initialize...

This adds some ambiguity in that we now have partially-filled
chunkedDiffer objects, but that's counterbalanced by having to
move around much fewer parameters and return values,
and there will be more to improve in the future.

Signed-off-by: Miloslav Trmač <[email protected]>
This centralizes 3 copies of the code into one, removing
a parameter, and in one case an error path.

Signed-off-by: Miloslav Trmač <[email protected]>
... to decrease the number of return values from the manifest
read functions.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
That's a logically better place, it pairs the getBlobAt
calls with the ErrBadRequest types specific to those call sites.

We will, also, add more fallback reasons.

Signed-off-by: Miloslav Trmač <[email protected]>
Copy link
Contributor

openshift-ci bot commented Jan 24, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtrmac

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant