Merge pull request #4198 from fuweid/ignore-ttrpc-closed

runtime: ignore ttrpc closed error
This commit is contained in:
Phil Estes 2020-04-20 12:32:26 -04:00 committed by GitHub
commit 1d083fec49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 7 deletions

View File

@ -226,11 +226,14 @@ func (s *shim) Delete(ctx context.Context) (*runtime.Exit, error) {
ID: s.ID(),
})
if shimErr != nil {
log.G(ctx).WithField("id", s.ID()).WithError(shimErr).Debug("failed to delete task")
if errors.Cause(shimErr) != ttrpc.ErrClosed {
shimErr = errdefs.FromGRPC(shimErr)
if !errdefs.IsNotFound(shimErr) {
return nil, shimErr
}
}
}
// remove self from the runtime task list
// this seems dirty but it cleans up the API across runtimes, tasks, and the service
s.rtTasks.Delete(ctx, s.ID())

View File

@ -7,7 +7,7 @@ github.com/containerd/console 8375c3424e4d7b114e8a90a4a40c
github.com/containerd/continuity 0ec596719c75bfd42908850990acea594b7593ac
github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13
github.com/containerd/go-runc a5c2862aed5e6358b305b0e16bfce58e0549b1cd
github.com/containerd/ttrpc 92c8520ef9f86600c650dd540266a007bf03670f # v1.0.0
github.com/containerd/ttrpc 6e416eafd26e6e738df716b21d421d5b59702bb4
github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40 # v1.0.0
github.com/coreos/go-systemd/v22 2d78030078ef61b3cae27f42ad6d0e46db51b339 # v22.0.0
github.com/cpuguy83/go-md2man 7762f7e404f8416dfa1d9bb6a8c192aa9acb4d19 # v1.0.10

View File

@ -338,9 +338,12 @@ func filterCloseErr(err error) error {
case strings.Contains(err.Error(), "use of closed network connection"):
return ErrClosed
default:
// if we have an epipe on a write, we cast to errclosed
if oerr, ok := err.(*net.OpError); ok && oerr.Op == "write" {
if serr, ok := oerr.Err.(*os.SyscallError); ok && serr.Err == syscall.EPIPE {
// if we have an epipe on a write or econnreset on a read , we cast to errclosed
if oerr, ok := err.(*net.OpError); ok && (oerr.Op == "write" || oerr.Op == "read") {
serr, sok := oerr.Err.(*os.SyscallError)
if sok && ((serr.Err == syscall.EPIPE && oerr.Op == "write") ||
(serr.Err == syscall.ECONNRESET && oerr.Op == "read")) {
return ErrClosed
}
}

13
vendor/github.com/containerd/ttrpc/go.mod generated vendored Normal file
View File

@ -0,0 +1,13 @@
module github.com/containerd/ttrpc
go 1.12
require (
github.com/gogo/protobuf v1.2.1
github.com/pkg/errors v0.8.1
github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1
github.com/sirupsen/logrus v1.4.2
golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5
google.golang.org/genproto v0.0.0-20190522204451-c2c4e71fbf69
google.golang.org/grpc v1.21.0
)