Merge pull request #2187 from crosbymichael/sigpipe

Handle SIGPIPE in shims
This commit is contained in:
Phil Estes 2018-03-06 13:31:39 -05:00 committed by GitHub
commit d086e56255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -208,6 +208,7 @@ func handleSignals(logger *logrus.Entry, signals chan os.Signal, server *ttrpc.S
sv.Delete(context.Background(), &ptypes.Empty{})
close(done)
})
case unix.SIGPIPE:
}
}
}

View File

@ -19,19 +19,19 @@ package main
import (
"os"
"os/signal"
"syscall"
"github.com/containerd/containerd/reaper"
runc "github.com/containerd/go-runc"
"github.com/opencontainers/runc/libcontainer/system"
"github.com/stevvooe/ttrpc"
"golang.org/x/sys/unix"
)
// setupSignals creates a new signal handler for all signals and sets the shim as a
// sub-reaper so that the container processes are reparented
func setupSignals() (chan os.Signal, error) {
signals := make(chan os.Signal, 32)
signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT, syscall.SIGCHLD)
signal.Notify(signals, unix.SIGTERM, unix.SIGINT, unix.SIGCHLD, unix.SIGPIPE)
// make sure runc is setup to use the monitor
// for waiting on processes
runc.Monitor = reaper.Default