Handle SIGPIPE in shims
ref: https://github.com/moby/moby/issues/36464 Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
2b6b99b4a1
commit
1eabab31aa
@ -208,6 +208,7 @@ func handleSignals(logger *logrus.Entry, signals chan os.Signal, server *ttrpc.S
|
|||||||
sv.Delete(context.Background(), &ptypes.Empty{})
|
sv.Delete(context.Background(), &ptypes.Empty{})
|
||||||
close(done)
|
close(done)
|
||||||
})
|
})
|
||||||
|
case unix.SIGPIPE:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,19 +19,19 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/containerd/containerd/reaper"
|
"github.com/containerd/containerd/reaper"
|
||||||
runc "github.com/containerd/go-runc"
|
runc "github.com/containerd/go-runc"
|
||||||
"github.com/opencontainers/runc/libcontainer/system"
|
"github.com/opencontainers/runc/libcontainer/system"
|
||||||
"github.com/stevvooe/ttrpc"
|
"github.com/stevvooe/ttrpc"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
// setupSignals creates a new signal handler for all signals and sets the shim as a
|
// setupSignals creates a new signal handler for all signals and sets the shim as a
|
||||||
// sub-reaper so that the container processes are reparented
|
// sub-reaper so that the container processes are reparented
|
||||||
func setupSignals() (chan os.Signal, error) {
|
func setupSignals() (chan os.Signal, error) {
|
||||||
signals := make(chan os.Signal, 32)
|
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
|
// make sure runc is setup to use the monitor
|
||||||
// for waiting on processes
|
// for waiting on processes
|
||||||
runc.Monitor = reaper.Default
|
runc.Monitor = reaper.Default
|
||||||
|
Loading…
Reference in New Issue
Block a user