Skip to content

Conversation

@coderbirju
Copy link
Contributor

This PR adds signal flag to the nerdctl container stop command

Copy link
Member

@djdongjin djdongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. Can we add a test for this?

One possible test is let a container sleep and stop it with both timeout and SIGKILL signal, then the container should be stopped before the timeout. But feel free to use other test that can test new signal is take effect.

Copy link
Member

@djdongjin djdongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just one minor comment, thanks

@djdongjin djdongjin added this to the v2.x.x (tentative) milestone Feb 17, 2025
@coderbirju coderbirju force-pushed the add-signal-container-stop branch from 5a0f902 to b542f5e Compare February 18, 2025 03:17
Signed-off-by: Arjun Raja Yogidas <[email protected]>
Comment on lines +87 to +94
trap 'echo "SIGQUIT received"; quit=1' QUIT
echo "Trap set"
while true; do
if [ $quit -eq 1 ]; then
echo "Quitting loop"
break
fi
echo "In loop"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @coderbirju why is this change needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably ok since it's just test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not change test logic, added a bit more logs and better loop break mechanism

Copy link
Contributor

@apostasie apostasie Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now racy: https://github.com/containerd/nerdctl/actions/runs/13462973052/job/37622397545#step:8:2221

The additional echo is probably exacerbating the condition.
Suggesting this test (and other similar) to first consume containers logs and wait to see "trap set" before sending the signal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving conversation to #3908

This is impacting a lot of recent builds on the Docker test part.

@djdongjin djdongjin merged commit 89003a5 into containerd:main Feb 18, 2025
30 checks passed
SilenceErrors: true,
}
stopCommand.Flags().IntP("time", "t", 10, "Seconds to wait before sending a SIGKILL")
stopCommand.Flags().StringP("signal", "s", "SIGTERM", "Signal to send to the container")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants