Merge pull request #4656 from zhuangqh/fix-unknown-state
CRI: always set unknown to false when handling exit event
This commit is contained in:
commit
839b136992
@ -325,14 +325,12 @@ func handleContainerExit(ctx context.Context, e *eventtypes.TaskExit, cntr conta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = cntr.Status.UpdateSync(func(status containerstore.Status) (containerstore.Status, error) {
|
err = cntr.Status.UpdateSync(func(status containerstore.Status) (containerstore.Status, error) {
|
||||||
// If FinishedAt has been set (e.g. with start failure), keep as
|
if status.FinishedAt == 0 {
|
||||||
// it is.
|
|
||||||
if status.FinishedAt != 0 {
|
|
||||||
return status, nil
|
|
||||||
}
|
|
||||||
status.Pid = 0
|
status.Pid = 0
|
||||||
status.FinishedAt = e.ExitedAt.UnixNano()
|
status.FinishedAt = e.ExitedAt.UnixNano()
|
||||||
status.ExitCode = int32(e.ExitStatus)
|
status.ExitCode = int32(e.ExitStatus)
|
||||||
|
}
|
||||||
|
|
||||||
// Unknown state can only transit to EXITED state, so we need
|
// Unknown state can only transit to EXITED state, so we need
|
||||||
// to handle unknown state here.
|
// to handle unknown state here.
|
||||||
if status.Unknown {
|
if status.Unknown {
|
||||||
|
Loading…
Reference in New Issue
Block a user