Skip to content

Commit abc0041

Browse files
Merge pull request #4918 from liusdu/sig_bus
signal: do not print message when dealing with SIG_PIPE
2 parents 38604a7 + 8627739 commit abc0041

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

cmd/containerd/command/main_unix.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ func handleSignals(ctx context.Context, signals chan os.Signal, serverC chan *se
4545
case s := <-serverC:
4646
server = s
4747
case s := <-signals:
48+
49+
// Do not print message when deailing with SIGPIPE, which may cause
50+
// nested signals and consume lots of cpu bandwidth.
51+
if s == unix.SIGPIPE {
52+
continue
53+
}
54+
4855
log.G(ctx).WithField("signal", s).Debug("received signal")
4956
switch s {
5057
case unix.SIGUSR1:
5158
dumpStacks(true)
52-
case unix.SIGPIPE:
53-
continue
5459
default:
5560
if err := notifyStopping(ctx); err != nil {
5661
log.G(ctx).WithError(err).Error("notify stopping failed")

0 commit comments

Comments
 (0)