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

storage: use race-free AddNames instead of SetNames #1480

Merged
merged 2 commits into from
Mar 2, 2022

Conversation

flouthoc
Copy link
Contributor

Commits from parallel builds using SetNames removes names from
storage for other builds.

Use race-free atomic AddNames to prevent breaking of parallel builds.

Uses c/storage from PR: containers/storage#1153

Fixes issue:

Builds fail with image not known.

Reproducer

#!/bin/bash
x=1
sudo ./podman rmi -af
rm -f log*.*
sudo ./podman build -t first . &> logfirst.log
while [ $x -le 30 ]
do
  echo "$x times"
  sudo ./podman build --log-level debug -t $x . &> log$x.log &
  x=$(( $x + 1 ))
#  sleep 1
done

Dockerfile

FROM quay.io/jitesoft/alpine

PS: I am not sure how to ensure parallel builds in CI and produce a race so not sure how to test this in CI.

@flouthoc
Copy link
Contributor Author

@giuseppe @vrothberg @mtrmac @nalind This fixes the reported issue. I have also shared a reproducer above which is fixed.

@flouthoc
Copy link
Contributor Author

flouthoc commented Feb 24, 2022

I have to point to actual c/storage version right now its my fork.

storage/storage_image.go Outdated Show resolved Hide resolved
storage/storage_image.go Outdated Show resolved Hide resolved
storage/storage_image.go Show resolved Hide resolved
storage/storage_image.go Outdated Show resolved Hide resolved
storage/storage_image.go Outdated Show resolved Hide resolved
storage/storage_image.go Outdated Show resolved Hide resolved
storage/storage_image.go Outdated Show resolved Hide resolved
storage/storage_image.go Outdated Show resolved Hide resolved
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

storage/storage_image.go Outdated Show resolved Hide resolved
storage/storage_image.go Outdated Show resolved Hide resolved
@flouthoc
Copy link
Contributor Author

Wait for containers/storage#1153 and tests to pass here: containers/podman#13339

Copy link
Collaborator

@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.

LGTM — just so that it isn‘t forgotten, the replace in go.mod should be replaced.

After that is done, and tests pass, feel free to merge without another review.

@mtrmac
Copy link
Collaborator

mtrmac commented Feb 25, 2022

Also: Thanks!

@flouthoc flouthoc force-pushed the race-free-commit branch 2 times, most recently from 9e8da2d to b361ff3 Compare March 1, 2022 16:38
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

go.mod Outdated Show resolved Hide resolved
@flouthoc
Copy link
Contributor Author

flouthoc commented Mar 1, 2022

@mtrmac @vrothberg done.

@flouthoc flouthoc requested review from mtrmac and vrothberg March 1, 2022 20:10
@mtrmac
Copy link
Collaborator

mtrmac commented Mar 1, 2022

LGTM. Can you rebase it over the release, please, so that it’s trivially clear which commits part of 5.20.0 and which commits come after? Feel free to merge afterwards.

flouthoc added a commit to flouthoc/podman that referenced this pull request Mar 3, 2022
Invoking parallel/concurrent builds from podman race against each other
following behviour was fixed in
containers/storage#1153 and containers/image#1480

Test verifies if following bug is fixed in new race-free API or not.
Read more about this issue, see bz 2055487 for more details.

More details here: containers/buildah#3794 and containers#13339

Co-authored-by: Ed Santiago <[email protected]>
Signed-off-by: Aditya R <[email protected]>
@flouthoc
Copy link
Contributor Author

@containers/image-maintainers @mtrmac @vrothberg I want to backport this commit to v5.16.0 but I was unable to find any maintenance branch for that. Is there any branch where i could raise a PR to get this backported.

Thanks

@vrothberg
Copy link
Member

@flouthoc, I just created one: https://github.com/containers/image/tree/release-5.16

When backporting, please make sure to bump the version accordingly in version/version.go.

Copy link
Collaborator

@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.

ACK to the code (but blocked on a c/storage release).

WRT the test failures, is it possible to fix that by updating SKOPEO_BRANCH on this branch to an appropriate consumer of c/image 5.16?

flouthoc added a commit to flouthoc/podman that referenced this pull request Mar 23, 2022
Invoking parallel/concurrent builds from podman race against each other
following behviour was fixed in
containers/storage#1153 and containers/image#1480

Test verifies if following bug is fixed in new race-free API or not.
Read more about this issue, see bz 2055487 for more details.

Test manually backported from: containers@63f92d0

Signed-off-by: Aditya R <[email protected]>
flouthoc added a commit to flouthoc/podman that referenced this pull request Mar 24, 2022
Invoking parallel/concurrent builds from podman race against each other
following behviour was fixed in
containers/storage#1153 and containers/image#1480

Test verifies if following bug is fixed in new race-free API or not.
Read more about this issue, see bz 2055487 for more details.

Test manually backported from: containers/podman@63f92d0

Signed-off-by: Aditya R <[email protected]>
flouthoc added a commit to flouthoc/podman that referenced this pull request Apr 6, 2022
Invoking parallel/concurrent builds from podman race against each other
following behviour was fixed in
containers/storage#1153 and containers/image#1480

Test verifies if following bug is fixed in new race-free API or not.
Read more about this issue, see bz 2055487 for more details.

More details here: containers/buildah#3794 and containers#13339

Co-authored-by: Ed Santiago <[email protected]>
Signed-off-by: Aditya R <[email protected]>
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.

4 participants