fix: prevent Podman system service to die in multi-stage built #7161
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 348 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.350
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7161"
general
weight: 0.35
nalind
In concurrent multi-stage builds (
--jobs > 1), if one stage fails,Build()'s cleanup setscontainerMap = nil. Sibling stage goroutines that are still in-processing can subsequently reachgetImageRootfs()and write intos.executor.containerMap, since this is empty map it will cause a errorpanic: assignment to entry in nil map. When running viapodman system service, this crash kills the entire daemon process.RootCause :
when a stage fails the cleanup() of that container is hit, which sets
containerMap = nil, if other gortoutine of the other stages tries to write into it, it fails and prompt thepanic: assignment to entry in nil map. it should first cancel all the other goroutines that are running concurrently and then setcontainerMap = nilFix :
1. Cleanup only happens when all goroutines have exited: The defer cleanup() (which sets
containerMap = nil) only runs after the main thread finishes waiting for all stage goroutines to completely finish and exit.2. Context cancellation stops sibling goroutines early: A cancellable
ctxis shared across all stages. When one stage fails, it calls cancel(), which signals all other in-processing sibling stages to abort their operations (RUN, COPY, image pulls) immediately.3. Filter and prompting back correct errors
What type of PR is this?
<!--
Please label this pull request according to what type of issue you are
addressing, especially if this is a release targeted pull request.
Uncomment only one
/kind <>line, hit enter to put that in a new line, andremove leading whitespace from that line:
-->
What this PR does / why we need it:
Which issue(s) this PR fixes:
fixes : https://github.com/podman-container-tools/podman/issues/29940
<!--
Automatically closes linked issue when PR is merged.
Uncomment the following comment block and include the issue
number or None on one line.
Usage:
Fixes #<issue number>, orFixes (paste link of issue), orNone.-->
<!--
Fixes #
or
None
-->
Special notes for your reviewer:
Does this PR introduce a user-facing change?
<!--
If no, just write
Nonein the release-note block below. If yes, a release noteis required: Enter your extended release note in the block below. If the PR
requires additional action from users switching to the new release, include the
string "action required".
For more information on release notes please follow the kubernetes model:
https://git.k8s.io/community/contributors/guide/release-notes.md
-->
``
release-note
``Fixed a panic ("assignment to entry in nil map") during concurrent multi-stage builds when a stage fails while sibling stages are still running while running via podman system servie