diff options
author | Stan Hu <stanhu@gmail.com> | 2021-02-13 02:02:29 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2021-02-13 02:06:00 +0300 |
commit | fb993e0b814a15602853d590d136815313ad9634 (patch) | |
tree | 7b0f24b5d39e9a78107fd62ced2eb880275f51c9 | |
parent | 75c835cb03c95a470becd8bd28cb0013249d407a (diff) |
Ignore SIGURG in gitaly-wrapper
In go1.14+, the go runtime issues SIGURG as an interrupt to support
pre-emptible system calls on Linux. We ignore this signal since it's not
relevant to the Gitaly process.
This reduces a significant amount of log noise.
Relates to https://gitlab.com/gitlab-org/gitaly/-/issues/3454
-rw-r--r-- | changelogs/unreleased/sh-ignore-sigurg.yml | 5 | ||||
-rw-r--r-- | cmd/gitaly-wrapper/main.go | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/changelogs/unreleased/sh-ignore-sigurg.yml b/changelogs/unreleased/sh-ignore-sigurg.yml new file mode 100644 index 000000000..90a326ae5 --- /dev/null +++ b/changelogs/unreleased/sh-ignore-sigurg.yml @@ -0,0 +1,5 @@ +--- +title: Ignore SIGURG in gitaly-wrapper +merge_request: 3131 +author: +type: changed diff --git a/cmd/gitaly-wrapper/main.go b/cmd/gitaly-wrapper/main.go index 1a9ee929a..f376fddea 100644 --- a/cmd/gitaly-wrapper/main.go +++ b/cmd/gitaly-wrapper/main.go @@ -15,6 +15,7 @@ import ( "gitlab.com/gitlab-org/gitaly/internal/bootstrap" "gitlab.com/gitlab-org/gitaly/internal/log" "gitlab.com/gitlab-org/gitaly/internal/ps" + "golang.org/x/sys/unix" ) const ( @@ -115,10 +116,21 @@ func spawnGitaly(bin string, args []string) (*os.Process, error) { return cmd.Process, nil } +func isRuntimeSig(s os.Signal) bool { + return s == unix.SIGURG +} + func forwardSignals(gitaly *os.Process, log *logrus.Entry) { sigs := make(chan os.Signal, 1) go func() { for sig := range sigs { + // In go1.14+, the go runtime issues SIGURG as an interrupt + // to support pre-emptible system calls on Linux. We ignore + // this signal since it's not relevant to the Gitaly process. + if isRuntimeSig(sig) { + continue + } + log.WithField("signal", sig).Warning("forwarding signal") if err := gitaly.Signal(sig); err != nil { |