cmd: crio: catch and ignore SIGPIPE
@@ -12,6 +12,7 @@ import (
"path/filepath"
"sort"
"strings"
+ "syscall"
"time"
"github.com/containers/libpod/pkg/hooks"
@@ -26,6 +27,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/soheilhy/cmux"
"github.com/urfave/cli"
+ "golang.org/x/sys/unix"
"google.golang.org/grpc"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)
@@ -201,15 +203,16 @@ func mergeConfig(config *server.Config, ctx *cli.Context) error {
}
func catchShutdown(ctx context.Context, cancel context.CancelFunc, gserver *grpc.Server, sserver *server.Server, hserver *http.Server, signalled *bool) {
- sig := make(chan os.Signal, 10)
- signal.Notify(sig, signals.Interrupt, signals.Term)
+ sig := make(chan os.Signal, 2048)
+ signal.Notify(sig, signals.Interrupt, signals.Term, syscall.SIGPIPE)
go func() {
for s := range sig {
+ logrus.WithFields(logrus.Fields{
+ "signal": s,
+ }).Debug("received signal")
switch s {
- case signals.Interrupt:
- logrus.Debugf("Caught SIGINT")
- case signals.Term:
- logrus.Debugf("Caught SIGTERM")
+ case unix.SIGPIPE:
+ continue
default:
continue
}
@@ -490,7 +493,6 @@ func main() {
app.Action = func(c *cli.Context) error {
ctx, cancel := context.WithCancel(context.Background())
-
if c.GlobalBool("profile") {
profilePort := c.GlobalInt("profile-port")
profileEndpoint := fmt.Sprintf("localhost:%v", profilePort)
