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:
authorSami Hiltunen <shiltunen@gitlab.com>2022-05-09 13:04:14 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2022-05-09 13:04:14 +0300
commitf05da743c0bb931180bc72159070e6633592dad8 (patch)
tree54c7f1ced4065bcfd4631648e6296b5b51a3d2cd
parentf93c64a5a41446b82850cc47d44c6960596f9e25 (diff)
parent3fcda892967769fbcb0b2f6ced3fba0641a57d4d (diff)
Merge branch 'pks-gitaly-config-improve-error-with-too-long-sockets' into 'master'
config: Improve error message when test socket creation fails See merge request gitlab-org/gitaly!4534
-rw-r--r--internal/gitaly/config/config.go8
-rw-r--r--internal/gitaly/config/config_test.go10
2 files changed, 8 insertions, 10 deletions
diff --git a/internal/gitaly/config/config.go b/internal/gitaly/config/config.go
index 8ed64b565..505a0fb9d 100644
--- a/internal/gitaly/config/config.go
+++ b/internal/gitaly/config/config.go
@@ -9,6 +9,7 @@ import (
"path/filepath"
"reflect"
"strings"
+ "syscall"
"time"
"github.com/pelletier/go-toml"
@@ -499,7 +500,12 @@ func trySocketCreation(dir string) error {
// Attempt to create an actual socket and not just a file to catch socket path length problems
l, err := net.Listen("unix", socketPath)
if err != nil {
- return fmt.Errorf("socket could not be created in %s: %s", dir, err)
+ var errno syscall.Errno
+ if errors.As(err, &errno) && errno == syscall.EINVAL {
+ return fmt.Errorf("%w: your socket path is likely too long, please change Gitaly's runtime directory", errno)
+ }
+
+ return fmt.Errorf("socket could not be created in %s: %w", dir, err)
}
return l.Close()
diff --git a/internal/gitaly/config/config_test.go b/internal/gitaly/config/config_test.go
index d683fa352..bbb348e60 100644
--- a/internal/gitaly/config/config_test.go
+++ b/internal/gitaly/config/config_test.go
@@ -677,15 +677,7 @@ func TestValidateInternalSocketDir(t *testing.T) {
return runtimeDirTooLongForSockets
},
verify: func(t *testing.T, runtimeDir string, actualErr error) {
- require.Error(t, actualErr)
- require.Regexp(t,
- fmt.Sprintf(
- "failed creating internal test socket: socket could not be created in %s: listen unix %s: bind: invalid argument",
- filepath.Join(runtimeDir, "sock\\.d"),
- filepath.Join(runtimeDir, "sock\\.d", "tsocket"),
- ),
- actualErr.Error(),
- )
+ require.EqualError(t, actualErr, "failed creating internal test socket: invalid argument: your socket path is likely too long, please change Gitaly's runtime directory")
},
},
}