Skip to content

source: avoid hang if no session id for oci-layout#3122

Merged
tonistiigi merged 1 commit intomoby:masterfrom
jedevc:oci-layout-timeout
Sep 20, 2022
Merged

source: avoid hang if no session id for oci-layout#3122
tonistiigi merged 1 commit intomoby:masterfrom
jedevc:oci-layout-timeout

Conversation

@jedevc
Copy link
Copy Markdown
Member

@jedevc jedevc commented Sep 20, 2022

Split out timeout fix from: #3118.

In the scenario with no session id, then the oci-layout resolver would still attempt to load a caller with the empty session id. This inevitably failed, and would fallback to any caller, but this would take 5 seconds to fail with the configured timeout.

In a fresh pull of an OCI image context, this could take up to 15 seconds, as 3 separate calls to the relevant functions would be made.

This patch fixes the issue by correctly identifying this case, and directly falling through to any caller. Additionally, if a session id is present, it will always be loaded with no fallback available. To do this consistently, the helper methods are refactored into a more consistent withCaller function.

CC @deitch

In the scenario with no session id, then the oci-layout resolver would
still attempt to load a caller with the empty session id. This
inevitably failed, and would fallback to any caller, but this would take
5 seconds to fail with the configured timeout.

In a fresh pull of an OCI image context, this could take up to 15
seconds, as 3 separate calls to the relevant functions would be made.

This patch fixes the issue by correctly identifying this case, and
directly falling through to any caller. Additionally, if a session id is
present, it will always be loaded with no fallback available. To do
this consistently, the helper methods are refactored into a more
consistent withCaller function.

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc requested a review from tonistiigi September 20, 2022 09:33
Copy link
Copy Markdown
Contributor

@deitch deitch left a comment

Choose a reason for hiding this comment

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

Thanks for finding this issue and fixing it @jedevc

@tonistiigi tonistiigi merged commit 20df1a8 into moby:master Sep 20, 2022
@jedevc jedevc deleted the oci-layout-timeout branch September 21, 2022 08:26
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.

3 participants