Skip to content

Commit 2aa8780

Browse files
authored
Merge pull request #3393 from lifupan/fix_deadshim
shimv2: remove the dead task from runtime task list
2 parents d80513e + ec8d9d3 commit 2aa8780

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

runtime/v2/manager.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ func (m *TaskManager) Create(ctx context.Context, id string, opts runtime.Create
140140
return
141141
}
142142
cleanupAfterDeadShim(context.Background(), id, ns, m.events, b)
143+
// Remove self from the runtime task list. Even though the cleanupAfterDeadShim()
144+
// would publish taskExit event, but the shim.Delete() would always failed with ttrpc
145+
// disconnect and there is no chance to remove this dead task from runtime task lists.
146+
// Thus it's better to delete it here.
147+
m.tasks.Delete(ctx, id)
143148
})
144149
if err != nil {
145150
return nil, err
@@ -258,6 +263,8 @@ func (m *TaskManager) loadTasks(ctx context.Context) error {
258263
return
259264
}
260265
cleanupAfterDeadShim(context.Background(), id, ns, m.events, binaryCall)
266+
// Remove self from the runtime task list.
267+
m.tasks.Delete(ctx, id)
261268
})
262269
if err != nil {
263270
cleanupAfterDeadShim(ctx, id, ns, m.events, binaryCall)

0 commit comments

Comments
 (0)