Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions internal/oci/runtime_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,10 @@ func (r *runtimeVM) StopContainer(ctx context.Context, c *Container, timeout int

stopCh := make(chan error)
go func() {
if _, err := r.wait(ctx, c.ID(), ""); err != nil {
// errdefs.ErrNotFound actually comes from a closed connection, which is expected
// when stoping the container, with the agent and the VM going off. In such case.
// let's just ignore the error.
if _, err := r.wait(ctx, c.ID(), ""); err != nil && !errors.Is(err, errdefs.ErrNotFound) {
stopCh <- errdefs.FromGRPC(err)
}

Expand Down Expand Up @@ -629,7 +632,7 @@ func (r *runtimeVM) updateContainerStatus(c *Container) error {
ID: c.ID(),
})
if err != nil {
if errors.Is(err, ttrpc.ErrClosed) {
if !errors.Is(err, ttrpc.ErrClosed) {
return errdefs.FromGRPC(err)
}
return errdefs.ErrNotFound
Expand Down Expand Up @@ -808,7 +811,10 @@ func (r *runtimeVM) wait(ctx context.Context, ctrID, execID string) (int32, erro
ExecID: execID,
})
if err != nil {
return -1, errdefs.FromGRPC(err)
if !errors.Is(err, ttrpc.ErrClosed) {
return -1, errdefs.FromGRPC(err)
}
return -1, errdefs.ErrNotFound
}

return int32(resp.ExitStatus), nil
Expand All @@ -831,7 +837,7 @@ func (r *runtimeVM) remove(ctx context.Context, ctrID, execID string) error {
if _, err := r.task.Delete(ctx, &task.DeleteRequest{
ID: ctrID,
ExecID: execID,
}); err != nil {
}); err != nil && !errors.Is(err, ttrpc.ErrClosed) {
return errdefs.FromGRPC(err)
}

Expand Down