Merge pull request #4918 from liusdu/sig_bus

signal: do not print message when dealing with SIG_PIPE
This commit is contained in:
Michael Crosby 2021-01-12 15:52:57 -05:00 committed by GitHub
commit abc0041a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,12 +45,17 @@ func handleSignals(ctx context.Context, signals chan os.Signal, serverC chan *se
case s := <-serverC: case s := <-serverC:
server = s server = s
case s := <-signals: case s := <-signals:
// Do not print message when deailing with SIGPIPE, which may cause
// nested signals and consume lots of cpu bandwidth.
if s == unix.SIGPIPE {
continue
}
log.G(ctx).WithField("signal", s).Debug("received signal") log.G(ctx).WithField("signal", s).Debug("received signal")
switch s { switch s {
case unix.SIGUSR1: case unix.SIGUSR1:
dumpStacks(true) dumpStacks(true)
case unix.SIGPIPE:
continue
default: default:
if err := notifyStopping(ctx); err != nil { if err := notifyStopping(ctx); err != nil {
log.G(ctx).WithError(err).Error("notify stopping failed") log.G(ctx).WithError(err).Error("notify stopping failed")