Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2020-06-02 07:21:00 +0300
committerStan Hu <stanhu@gmail.com>2020-06-03 03:52:26 +0300
commit1ff8407d4dc56a7ad2a610eea23491cb7bf1d9ba (patch)
treeb4ea330a6524c21c0b9555453560faf2592c8881
parent8e18cae9f3d52b6838dc02a0eebdd17b0748d34a (diff)
Warn if SO_REUSEPORT cannot be set
On some kernels prior to Linux 3.9 (e.g. Oracle Linux v6.5), this kernel feature may not be available. Instead of failing hard, we just display a warning message that no-downtime upgrades will not work properly. After we deprecate CentOS 6 (https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5163), we can revert this.
-rw-r--r--changelogs/unreleased/sh-warn-soreuseport.yml5
-rw-r--r--internal/bootstrap/bootstrap.go8
2 files changed, 11 insertions, 2 deletions
diff --git a/changelogs/unreleased/sh-warn-soreuseport.yml b/changelogs/unreleased/sh-warn-soreuseport.yml
new file mode 100644
index 000000000..2014bb691
--- /dev/null
+++ b/changelogs/unreleased/sh-warn-soreuseport.yml
@@ -0,0 +1,5 @@
+---
+title: Warn if SO_REUSEPORT cannot be set
+merge_request: 2236
+author:
+type: fixed
diff --git a/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go
index 2c8c35d9a..bcd1b296d 100644
--- a/internal/bootstrap/bootstrap.go
+++ b/internal/bootstrap/bootstrap.go
@@ -18,6 +18,7 @@ const (
EnvPidFile = "GITALY_PID_FILE"
// EnvUpgradesEnabled is an environment variable that when defined gitaly must enable graceful upgrades on SIGHUP
EnvUpgradesEnabled = "GITALY_UPGRADES_ENABLED"
+ SocketReusePortWarning = "Unable to set SO_REUSEPORT: zero downtime upgrades will not work"
)
// Bootstrap handles graceful upgrades
@@ -76,9 +77,12 @@ func New() (*Bootstrap, error) {
opErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
})
if err != nil {
- return err
+ log.WithError(err).Warn(SocketReusePortWarning)
}
- return opErr
+ if opErr != nil {
+ log.WithError(opErr).Warn(SocketReusePortWarning)
+ }
+ return nil
},
},
})