Skip to content

Commit 839b136

Browse files
authored
Merge pull request #4656 from zhuangqh/fix-unknown-state
CRI: always set unknown to false when handling exit event
2 parents 65e3989 + 30c9add commit 839b136

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

pkg/cri/server/events.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,12 @@ func handleContainerExit(ctx context.Context, e *eventtypes.TaskExit, cntr conta
325325
}
326326
}
327327
err = cntr.Status.UpdateSync(func(status containerstore.Status) (containerstore.Status, error) {
328-
// If FinishedAt has been set (e.g. with start failure), keep as
329-
// it is.
330-
if status.FinishedAt != 0 {
331-
return status, nil
328+
if status.FinishedAt == 0 {
329+
status.Pid = 0
330+
status.FinishedAt = e.ExitedAt.UnixNano()
331+
status.ExitCode = int32(e.ExitStatus)
332332
}
333-
status.Pid = 0
334-
status.FinishedAt = e.ExitedAt.UnixNano()
335-
status.ExitCode = int32(e.ExitStatus)
333+
336334
// Unknown state can only transit to EXITED state, so we need
337335
// to handle unknown state here.
338336
if status.Unknown {

0 commit comments

Comments
 (0)