Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime_vm: Ignore ttrpc.ErrClosed when shutting the container down
When shutting the container down, we're dealing with the following piece of code on Kata side: https://github.com/kata-containers/runtime/blob/master/containerd-shim-v2/service.go#L785 ``` func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (_ *ptypes.Empty, err error) { defer func() { err = toGRPC(err) }() s.mu.Lock() if len(s.containers) != 0 { s.mu.Unlock() return empty, nil } s.mu.Unlock() s.cancel() os.Exit(0) // This will never be called, but this is only there to make sure the // program can compile. return empty, nil } ``` The code shown above will simply stop the service, closing the ttrpc channel, raising then the "ErrClosed" error, which is returned by the Shutdown. Differently from containerd code, which simply igores the error, CRI-O propagates the error, leaving a bunch of processes behind that will never ever be closed. Here's what containerd does: https://github.com/containerd/containerd/blob/master/runtime/v2/shim.go#L194 ``` _, err := s.task.Shutdown(ctx, &task.ShutdownRequest{ ID: s.ID(), }) if err != nil && !errors.Is(err, ttrpc.ErrClosed) { return errdefs.FromGRPC(err) } ``` Knowing that, let's mimic what's been done by containerd and ignore the error in this specific case. Related: kata-containers/runtime#2719 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
- Loading branch information