-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Change to correct break statements to prevent infinite recursion causing OOM #16166
Conversation
There does not seem to be any fitting test I can modify or extend. Am I missing something or is it not implemented yet? Should I skip writing tests? |
Thanks for your PR and for asking about tests. https://github.com/containers/podman/blob/24b586e7d6b7b4940aef8a5929283519020d2806/test/system/330-corrupt-images.bats might be a candidate for a test; but from my quick reading, is there even a reliable reproducer for this? |
Thanks for your reply!
That seemed to reproduce the issue alright, but it's not a pretty solution. The faults with selects in |
@mheon PTAL |
Code LGTM over here. /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mheon, misuto 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 |
@misuto Could you rebase and repush, so the tests will pass. |
Signed-off-by: Jakob Tigerström <[email protected]>
Awesome work @misuto Thanks. |
Thank you, hope I can contribute with something more in the future! |
Problem description and Solution
I discovered that an image pull could end up in infinite recursion if the context is cancelled while pulling. The reason is that the
break
statement only breaks theselect
instead of thefor
.I found a few other places in
pkg/bindings
that also seemed to have the same issue, which I included a fix for. The solution is to put a label at thefor
loop and reference that when breaking in the cases forpull.go
andpush.go
. Inmanifests.go
there were no return statement outside of thefor
loop so I opted to return an empty string along with the errorcontext.Canceled
.Does this PR introduce a user-facing change?
[NO NEW TESTS NEEDED]