fix(podman): combine sandbox stop and removal - #2570
Merged
Conversation
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
pimlock
requested review from
a team,
derekwaynecarr,
maxamillion and
mrunalp
as code owners
July 31, 2026 01:04
pimlock
commented
Jul 31, 2026
|
Label |
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
matthewgrossman
previously approved these changes
Jul 31, 2026
matthewgrossman
left a comment
Contributor
There was a problem hiding this comment.
optional comment from my agent about a now net-reduced timeout
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
matthewgrossman
approved these changes
Jul 31, 2026
matthewgrossman
left a comment
Contributor
There was a problem hiding this comment.
reviewed latest solution together over a call
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.
Summary
Collapse the Podman driver's separate stop and remove requests into one timed Libpod delete request. Graceful shutdown behavior already existed and is preserved; the change removes the externally scheduled interval between the requests and explicitly applies OpenShell's configured stop timeout to removal.
This mitigates the Podman
type=imagemount lifecycle race observed when one sandbox reaches its stop timeout while another sandbox starts, without globally serializing sandbox lifecycle operations.The change also corrects anonymous-volume removal to use the Libpod endpoint's
volumes=trueparameter. The Docker-compatible endpoint usesv=true; OpenShell calls the Libpod endpoint.Related Issue
Related to the investigation in #2568.
No issue required: this is a localized compatibility fix for the Podman sandbox driver.
Changes
DELETE ...?force=true&volumes=true&timeout=<configured stop timeout>v=trueparameter to the Libpod-specificvolumes=trueparameter.Why
volumes=true, notv=truePodman's generated API documentation currently shows
vforContainerDeleteLibpod, but the server handler distinguishes the two API families:RmOptions.Volumesfrom thevolumesquery parameter.vquery parameter.This behavior is present in both the affected Podman 4.9.3 handler and the Podman 6.0.1 handler. OpenShell sends requests to
/libpod/containers/..., sovolumes=trueis the parameter the implementation consumes.The previous driver sent
v=true, which the Libpod handler ignored. This did not cause the image-mount race, and OpenShell separately removes its named sandbox volume, but it meant the request did not remove anonymous volumes as intended.Reproduction and evidence
The failure was reproduced without OpenShell using:
crun1.14.1ghcr.io/nvidia/openshell/supervisor:02e890ccf1995bf8671a81ec84baf44328b7f5b8The standalone reproducer stopped old containers and started pre-created replacements around the ten-second stop-timeout boundary before removing the old containers. On batch 8, two replacement starts failed because their OCI specifications referenced Podman-owned image-overlay mount sources that no longer existed. The missing paths belonged to the new containers, not the containers being removed.
Starting replacements concurrently with the beginning of immediate teardown did not reproduce across thousands of overlaps. The sensitive window was the transition from stop timeout into final removal.
Changing the lifecycle shape to a single timed forced removal completed 40/40 deliberately timed overlaps without reproducing the missing mount source.
Semantics and confidence
The old and new successful paths both stop a running container gracefully before removal:
POST /stop?t=<configured timeout>, followed byDELETE ?force=trueafter the container stopped.DELETE ?force=true&timeout=<configured timeout>operation; Podman stops the running container and then removes it.The new behavior does not introduce graceful shutdown. It preserves it while eliminating the inter-request scheduling boundary and explicitly applying OpenShell's configured timeout to the forced delete.
The intentional edge-case difference is that the old driver ignored failure from its preliminary stop request. If the container remained running, the subsequent forced removal could make another stop attempt using the container's configured stop timeout, normally ten seconds. The combined operation makes one shutdown attempt with OpenShell's configured timeout and returns its error, avoiding both a possible second timeout period and the inter-request window.
This is an evidence-backed mitigation, not proof that Podman's underlying storage race is impossible:
Testing
mise run pre-commitpassesmise exec -- cargo test -p openshell-driver-podman(135 passed)Checklist