runtime: force stop container after the container process exits

Set thestop container force flag to true so that the container state is always set to
“StateStopped” after the container wait goroutine is finished. This is necessary for
the following delete container step to succeed.

Fixes: #4359

Signed-off-by: Feng Wang <feng.wang@databricks.com>
This commit is contained in:
Feng Wang 2022-06-01 13:14:20 -07:00
parent a9a3074828
commit 9726f56fdc

View File

@ -78,7 +78,7 @@ func wait(ctx context.Context, s *service, c *container, execID string) (int32,
shimLog.WithField("sandbox", s.sandbox.ID()).Error("failed to delete sandbox") shimLog.WithField("sandbox", s.sandbox.ID()).Error("failed to delete sandbox")
} }
} else { } else {
if _, err = s.sandbox.StopContainer(ctx, c.id, false); err != nil { if _, err = s.sandbox.StopContainer(ctx, c.id, true); err != nil {
shimLog.WithError(err).WithField("container", c.id).Warn("stop container failed") shimLog.WithError(err).WithField("container", c.id).Warn("stop container failed")
} }
} }