Skip to content

Commit

Permalink
KillContainer: improve error message
Browse files Browse the repository at this point in the history
To improve the error message reported in containers#16142 where the container is
reported to be in the wrong state but we do not know which.  This is not
a fix for containers#16142 but will hopefully aid in better understanding what's
going on if it flakes again.

[NO NEW TESTS NEEDED] as hitting the condition is inherently racy.

Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed Oct 13, 2022
1 parent dfb4364 commit 1d18dc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/oci_conmon_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ func (r *ConmonOCIRuntime) KillContainer(ctr *Container, signal uint, all bool)
logrus.Infof("Error updating status for container %s: %v", ctr.ID(), err2)
}
if ctr.ensureState(define.ContainerStateStopped, define.ContainerStateExited) {
return define.ErrCtrStateInvalid
return fmt.Errorf("%w: %s", define.ErrCtrStateInvalid, ctr.state.State)
}
return fmt.Errorf("sending signal to container %s: %w", ctr.ID(), err)
}
Expand Down

0 comments on commit 1d18dc2

Please sign in to comment.