[sandbox] Fix panic when waiting for sandbox controller
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
dbc6d33ac5
commit
9f4ba48839
@ -296,17 +296,20 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
|
|||||||
// but we don't care about sandbox TaskOOM right now, so it is fine.
|
// but we don't care about sandbox TaskOOM right now, so it is fine.
|
||||||
go func() {
|
go func() {
|
||||||
resp, err := controller.Wait(context.Background(), id)
|
resp, err := controller.Wait(context.Background(), id)
|
||||||
if err != nil && err != context.Canceled && err != context.DeadlineExceeded {
|
if err != nil {
|
||||||
e := &eventtypes.TaskExit{
|
log.G(ctx).WithError(err).Error("failed to wait for sandbox controller, skipping exit event")
|
||||||
ContainerID: id,
|
return
|
||||||
ID: id,
|
|
||||||
// Pid is not used
|
|
||||||
Pid: 0,
|
|
||||||
ExitStatus: resp.ExitStatus,
|
|
||||||
ExitedAt: resp.ExitedAt,
|
|
||||||
}
|
|
||||||
c.eventMonitor.backOff.enBackOff(id, e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e := &eventtypes.TaskExit{
|
||||||
|
ContainerID: id,
|
||||||
|
ID: id,
|
||||||
|
// Pid is not used
|
||||||
|
Pid: 0,
|
||||||
|
ExitStatus: resp.ExitStatus,
|
||||||
|
ExitedAt: resp.ExitedAt,
|
||||||
|
}
|
||||||
|
c.eventMonitor.backOff.enBackOff(id, e)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
sandboxRuntimeCreateTimer.WithValues(labels["oci_runtime_type"]).UpdateSince(runtimeStart)
|
sandboxRuntimeCreateTimer.WithValues(labels["oci_runtime_type"]).UpdateSince(runtimeStart)
|
||||||
|
Loading…
Reference in New Issue
Block a user