← Back to Pull requests

fix: prevent Podman system service to die in multi-stage built #7161

Closed
unknown closed this pull request without merging on Oct 13, 2026 21:05 UTC
View on GitHub
unknown unknown commented on Oct 12, 2026 16:15 UTC
Author

In concurrent multi-stage builds (--jobs > 1), if one stage fails, Build()'s cleanup sets containerMap = nil. Sibling stage goroutines that are still in-processing can subsequently reach getImageRootfs() and write into s.executor.containerMap, since this is empty map it will cause a error panic: assignment to entry in nil map. When running via podman 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 the panic: assignment to entry in nil map. it should first cancel all the other goroutines that are running concurrently and then set containerMap = nil

Fix :
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 ctx is 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, and
remove leading whitespace from that line:
-->

/kind bug

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>, or Fixes (paste link of issue), or None.
-->

<!--
Fixes #
or
None
-->

Special notes for your reviewer:

Does this PR introduce a user-facing change?

<!--
If no, just write None in the release-note block below. If yes, a release note
is 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
``

Diff: 348 lines (+261 / -87) across 4 files Reviewer: nalind Review duration: 1729m
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
0.42
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.4% (MEDIUM) · Higher = larger blast radius
42.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.8% · Safe to merge
16.8%