fix(kill): do not mark non-stop signals as an explicit stop - #5174
Open
somaz94 wants to merge 1 commit into
Open
fix(kill): do not mark non-stop signals as an explicit stop#5174somaz94 wants to merge 1 commit into
somaz94 wants to merge 1 commit into
Conversation
`nerdctl kill` accepts any signal, but it recorded every one of them by setting containerd.io/restart.explicitly-stopped to true before sending it. That label is what tells the containerd restart monitor to leave a container alone, so sending a signal that is not meant to stop the container, such as SIGHUP, permanently suppressed its restart policy. The container kept running and looked healthy, and nothing reported that its --restart=always had stopped applying. Set the label only when the signal is expected to stop the container: SIGKILL, or a signal matching the container's own stop signal. The stop signal is resolved by the same rule `nerdctl stop` already uses, the stopSignal label if present and SIGTERM otherwise, so the two commands cannot disagree about what stops a container. An unparsable stopSignal label is returned as an error rather than guessed at, which is what `nerdctl stop` already does with it. `nerdctl stop` is unchanged. It stops the container by definition, so it still sets the label unconditionally. Assisted-by: Claude Code (Opus 5) Signed-off-by: somaz <genius5711@gmail.com>
somaz94
added a commit
to somaz94/somaz94
that referenced
this pull request
Sep 2, 2026
somaz94
marked this pull request as ready for review
September 2, 2026 06:00
Author
|
The three failing jobs look unrelated to this change. TestSaveQuiet, TestLoadQuiet and TestSaveContent are image save/load tests, The test workflow on main has failed 14 of its last 15 runs, with different |
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.
nerdctl killsetcontainerd.io/restart.explicitly-stoppedbefore sendingany signal, so
nerdctl kill --signal HUPon a--restart=alwayscontainerpermanently suppressed its restart policy. Nothing reported it: the container
kept running and looked healthy.
The label is now set only when the signal is expected to stop the container:
SIGKILL, or a signal matching the container's own stop signal. That stop
signal is resolved by the same rule
nerdctl stopalready uses(
containerutil.getSignal): the stopSignal label if present, SIGTERMotherwise, so the two commands cannot disagree about what stops a container.
An unparsable stopSignal label is returned as an error rather than guessed
at, matching what
nerdctl stopalready does with it.nerdctl stopis unchanged: it stops the container by definition, so itstill sets the label unconditionally.
Validation:
make lint-go-all(linux/windows/freebsd/darwin) andmake lint-mod: 0 issues,using the golangci-lint version pinned in
install-dev-toolsmake lint-commits: PASSTestIsStopSignal(6 cases) and integration testTestRunRestartAlwaysKillSignal(3 subtests) pass against containerd 2.2.2IsStopSignalalways return true fails only the non-stop-signal subtest, and narrowing it
to SIGKILL only fails only the stop-signal-match subtest
make test: unchanged exceptpkg/resolvconf.TestGet, which fails the sameway on a clean checkout of
mainin this environmentcloses: #5171