-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure that containers do not get stuck in stopping #22641
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1465,4 +1465,44 @@ search | $IMAGE | | |
is "$output" "Error.*: $expect" "podman emits useful diagnostic when no entrypoint is set" | ||
} | ||
|
||
@test "podman run - stopping loop" { | ||
skip_if_remote "this doesn't work with with the REST service" | ||
|
||
run_podman run -d --name testctr --stop-timeout 240 $IMAGE sh -c 'echo READY; sleep 999' | ||
cid="$output" | ||
wait_for_ready testctr | ||
|
||
run_podman inspect --format '{{ .State.ConmonPid }}' testctr | ||
conmon_pid=$output | ||
|
||
${PODMAN} stop testctr & | ||
stop_pid=$! | ||
|
||
timeout=20 | ||
while :;do | ||
sleep 0.5 | ||
run_podman container inspect --format '{{.State.Status}}' testctr | ||
if [[ "$output" = "stopping" ]]; then | ||
break | ||
fi | ||
timeout=$((timeout - 1)) | ||
if [[ $timeout == 0 ]]; then | ||
run_podman ps -a | ||
die "Timed out waiting for testctr to acknowledge signal" | ||
fi | ||
done | ||
|
||
kill -9 ${stop_pid} | ||
kill -9 ${conmon_pid} | ||
|
||
# Unclear why `-t0` is required here, works locally without. | ||
# But it shouldn't hurt and does make the test pass... | ||
PODMAN_TIMEOUT=5 run_podman 125 stop -t0 testctr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @edsantiago Why PODMAN_TIMEOUT=5? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leftover artifact from my testing: I got tired of ^Cing on every single iteration (until I hit upon the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is confusing to readers that ask why is this here. |
||
is "$output" "Error: container .* conmon exited prematurely, exit code could not be retrieved: internal libpod error" "correct error on missing conmon" | ||
|
||
# This should be safe because stop is guaranteed to call cleanup? | ||
run_podman inspect --format "{{ .State.Status }}" testctr | ||
is "$output" "exited" "container has successfully transitioned to exited state after stop" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm... I'm nervous. In my version, this line said There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. We want |
||
} | ||
|
||
# vim: filetype=sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edsantiago PTAL