Make sure exec process is killed when context is canceled.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu 2019-05-28 12:25:03 -07:00
parent ac9f8e1c4d
commit d257c16dbc

View File

@ -134,7 +134,7 @@ func (c *criService) execInContainer(ctx context.Context, id string, opts execOp
defer func() { defer func() {
deferCtx, deferCancel := ctrdutil.DeferContext() deferCtx, deferCancel := ctrdutil.DeferContext()
defer deferCancel() defer deferCancel()
if _, err := process.Delete(deferCtx); err != nil { if _, err := process.Delete(deferCtx, containerd.WithProcessKill); err != nil {
logrus.WithError(err).Errorf("Failed to delete exec process %q for container %q", execID, id) logrus.WithError(err).Errorf("Failed to delete exec process %q for container %q", execID, id)
} }
}() }()