diff options
author | Paul Okstad <pokstad@gitlab.com> | 2021-02-13 02:37:25 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2021-02-13 02:37:25 +0300 |
commit | f319db221de49c979f3606e3934bd76c218f813d (patch) | |
tree | 814f7dfc2c7d30f78e160224af57fe730122f43b | |
parent | feade4da693bb6657c16960d6bc988378527b9a0 (diff) | |
parent | fb993e0b814a15602853d590d136815313ad9634 (diff) |
Merge branch 'sh-ignore-sigurg' into 'master'
Ignore SIGURG in gitaly-wrapper
See merge request gitlab-org/gitaly!3131
-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 { |