Merge pull request #3209 from Random-Liu/fix-v1-shim-cleanup
Shim v1: Check task list to avoid unnecessary cleanup.
This commit is contained in:
commit
4c16017e2f
@ -338,8 +338,12 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
|
|||||||
ctx = namespaces.WithNamespace(ctx, ns)
|
ctx = namespaces.WithNamespace(ctx, ns)
|
||||||
pid, _ := runc.ReadPidFile(filepath.Join(bundle.path, proc.InitPidFile))
|
pid, _ := runc.ReadPidFile(filepath.Join(bundle.path, proc.InitPidFile))
|
||||||
s, err := bundle.NewShimClient(ctx, ns, ShimConnect(r.config, func() {
|
s, err := bundle.NewShimClient(ctx, ns, ShimConnect(r.config, func() {
|
||||||
err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid)
|
_, err := r.tasks.Get(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Task was never started or was already successfully deleted
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid); err != nil {
|
||||||
log.G(ctx).WithError(err).WithField("bundle", bundle.path).
|
log.G(ctx).WithError(err).WithField("bundle", bundle.path).
|
||||||
Error("cleaning up after dead shim")
|
Error("cleaning up after dead shim")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user