diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 2968d2d48c..aeedbf3f42 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1544,7 +1544,7 @@ func (c *Container) waitForConmonToExitAndSave() error { logrus.Errorf("Error cleaning up container %s after Conmon exited prematurely: %v", c.ID(), err) } - return fmt.Errorf("container %s conmon exited prematurely, exit code could not be retrieved: %w", c.ID(), define.ErrInternal) + return fmt.Errorf("container %s conmon exited prematurely, exit code could not be retrieved: %w", c.ID(), define.ErrConmonDead) } return c.save() diff --git a/test/system/030-run.bats b/test/system/030-run.bats index ce36b85ab0..eb0b90a926 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -1778,7 +1778,7 @@ search | $IMAGE | # 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 $cname - is "$output" "Error: container .* conmon exited prematurely, exit code could not be retrieved: internal libpod error" "correct error on missing conmon" + is "$output" "Error: container .* conmon exited prematurely, exit code could not be retrieved: conmon process killed" "correct error on missing conmon" # This should be safe because stop is guaranteed to call cleanup? run_podman inspect --format "{{ .State.Status }}" $cname diff --git a/test/system/055-rm.bats b/test/system/055-rm.bats index c0e674c0c3..6c8e058260 100644 --- a/test/system/055-rm.bats +++ b/test/system/055-rm.bats @@ -202,4 +202,20 @@ function __run_healthcheck_container() { die "Container never entered 'stopping' state" } +# bats test_tags=ci:parallel +@test "podman rm after killed conmon" { + cname=c_$(safename) + run_podman run -d --name $cname $IMAGE sleep 1000 + + run_podman inspect --format '{{ .State.ConmonPid }}' $cname + conmon_pid=$output + + kill -9 ${conmon_pid} + + run_podman rm -f -t0 $cname + + run_podman 125 container inspect $cname + assert "$output" =~ "no such container \"$cname\"" "Container should be removed" +} + # vim: filetype=sh