Skip to content

Commit

Permalink
Merge pull request #3393 from lifupan/fix_deadshim
Browse files Browse the repository at this point in the history
shimv2: remove the dead task from runtime task list
  • Loading branch information
estesp committed Jul 8, 2019
2 parents d80513e + ec8d9d3 commit 2aa8780
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions runtime/v2/manager.go
Expand Up @@ -140,6 +140,11 @@ func (m *TaskManager) Create(ctx context.Context, id string, opts runtime.Create
return
}
cleanupAfterDeadShim(context.Background(), id, ns, m.events, b)
// Remove self from the runtime task list. Even though the cleanupAfterDeadShim()
// would publish taskExit event, but the shim.Delete() would always failed with ttrpc
// disconnect and there is no chance to remove this dead task from runtime task lists.
// Thus it's better to delete it here.
m.tasks.Delete(ctx, id)
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -258,6 +263,8 @@ func (m *TaskManager) loadTasks(ctx context.Context) error {
return
}
cleanupAfterDeadShim(context.Background(), id, ns, m.events, binaryCall)
// Remove self from the runtime task list.
m.tasks.Delete(ctx, id)
})
if err != nil {
cleanupAfterDeadShim(ctx, id, ns, m.events, binaryCall)
Expand Down

0 comments on commit 2aa8780

Please sign in to comment.