Skip to content

Commit ec8d9d3

Browse files
committed
shimv2: remove the dead task from runtime task list
When shimv2 dead, the container would be cleanup, but the corresponding runtime task still existed in runtime task lists, it should be deleted too. Signed-off-by: lifupan <[email protected]>
1 parent cbb108e commit ec8d9d3

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)