Honor an explicit stop signal on container stop#29052
Open
shuaiyuanxx wants to merge 1 commit into
Open
Conversation
podman ignored the signal for a graceful stop: the compat /stop endpoint dropped the "signal" query parameter, `podman stop` had no --signal flag, and the OCI runtime always used the container's configured StopSignal. So there was no way to stop a container with an override signal, even though Docker has supported `stop --signal` (and the API "signal" parameter) since v1.42. Thread an optional stop signal from the CLI (--signal/-s), the remote bindings, and the compat/libpod /stop endpoint through to the OCI runtime. The runtime uses the override when given (0 = the container's configured StopSignal) and still escalates to SIGKILL after the timeout. Internal stop paths pass 0, so behavior is unchanged when no signal is requested. Signed-off-by: Shuai Yuan <shuaiyuanzju@gmail.com>
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.
What this PR does / why we need it:
podman ignored the signal for a graceful stop: the compat
/stopendpoint dropped thesignalquery parameter,podman stophad no--signalflag, and the OCI runtime always used the container's configuredStopSignal. Docker has supportedstop --signal(and the APIsignalparameter) since v1.42, so there was no way to stop a container with an override signal.This threads an optional stop signal from the CLI (
--signal/-s), the remote bindings, and the compat/libpod/stopendpoint down to the OCI runtime, which uses the override when given (0 = the configured StopSignal) and still escalates to SIGKILL after the timeout. Internal stop paths pass 0, so behavior is unchanged when no signal is requested.How to verify it
New e2e test:
podman stop container --signal.Which issue(s) this PR fixes:
None
Checklist
Fixes: #issue(if applicable) — no related issuepodman-stop.1.md.in)make validatepr— ran gofmt +go vet ./test/e2e+ binary build + a runtime check; haven't run the full validateprDoes this PR introduce a user-facing change?