registry: fix TOCTOU race condition in local registry initialization - #143
Merged
alicefr merged 1 commit intoSep 21, 2026
Merged
Conversation
HarshwardhanPatil07
force-pushed
the
fix-registry-race-condition
branch
from
September 21, 2026 06:13
81a0b47 to
c0cd0bc
Compare
Member
Author
|
saw tests failing in #142 |
alicefr
reviewed
Sep 21, 2026
| status, err := m.podman.ContainerStatus(ctx, name) | ||
| var status string | ||
| var err error | ||
| for attempts := 0; attempts < 10; attempts++ { |
Collaborator
There was a problem hiding this comment.
Does this try 10 times if the container hasn't been started?
Member
Author
There was a problem hiding this comment.
yep, reduced it to 3 retries. Thank you!
Collaborator
There was a problem hiding this comment.
Ok, this isn't the default path so we don't always retry at every registry creation
Collaborator
There was a problem hiding this comment.
Can we add the retries logic in the function recoverFromConcurrentCreate? This is already done for exactly catch that case
HarshwardhanPatil07
force-pushed
the
fix-registry-race-condition
branch
from
September 21, 2026 06:58
c0cd0bc to
d87fb5a
Compare
In parallel integration test runs, multiple cluster start operations concurrently ensure the shared singleton bink-registry container. When two workers attempt to create the container at the same time, the losing worker encounters an 'already in use' conflict and enters recoverFromConcurrentCreate. Calling ensureExistingContainer immediately can fail with a 404 "no such container" error while Podman's internal container record is still settling. Additionally, concurrent ContainerStart invocations can race if another worker transitions the container to running mid-flight. Fix this by: 1. Retrying ensure in recoverFromConcurrentCreate with backoff when concurrent creation is detected, giving the winning worker time to finalize container creation. 2. Checking if the container is already running before failing if ContainerStart returns an error during concurrent startup. 3. Pre-starting the shared registry once in SynchronizedBeforeSuite on Node 1 before parallel integration test workers run. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
HarshwardhanPatil07
force-pushed
the
fix-registry-race-condition
branch
from
September 21, 2026 07:20
d87fb5a to
e5a8024
Compare
alicefr
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In parallel integration test runs, multiple cluster start operations
concurrently ensure the shared singleton bink-registry container.
When a worker invokes ensureExistingContainer (either because ContainerExists
returned true or following a concurrent creation conflict), calling
ContainerStatus immediately can fail with a 404 "no such container"
error while Podman's internal container state is still settling. Additionally,
concurrent ContainerStart invocations can race if another worker transitions
the container to running mid-flight.
Fix this by:
to allow transient unready/inspection states to settle.
ContainerStart returns an error during concurrent startup.
Node 1 before parallel integration test workers run.
Assisted-by: AI