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:
-rw-r--r--internal/gitaly/config/config.go4
-rw-r--r--internal/gitaly/config/config_test.go6
2 files changed, 9 insertions, 1 deletions
diff --git a/internal/gitaly/config/config.go b/internal/gitaly/config/config.go
index 460c6114a..0e458b0ba 100644
--- a/internal/gitaly/config/config.go
+++ b/internal/gitaly/config/config.go
@@ -586,7 +586,9 @@ func PruneRuntimeDirectories(log log.FieldLogger, runtimeDir string) error {
}()
if err := process.Signal(syscall.Signal(0)); err != nil {
- if !errors.Is(err, os.ErrProcessDone) {
+ // Either the process does not exist, or the pid has been re-used by for a
+ // process owned by another user and is not a Gitaly process.
+ if !errors.Is(err, os.ErrProcessDone) && !errors.Is(err, syscall.EPERM) {
return fmt.Errorf("signal: %w", err)
}
diff --git a/internal/gitaly/config/config_test.go b/internal/gitaly/config/config_test.go
index b5690bf98..132bdc68d 100644
--- a/internal/gitaly/config/config_test.go
+++ b/internal/gitaly/config/config_test.go
@@ -1336,6 +1336,12 @@ func TestPruneRuntimeDirectories(t *testing.T) {
expectedLogs[staleRuntimeDir] = "removing leftover runtime directory"
}
+ // Setup runtime directory with pid of process not owned by git user
+ rootRuntimeDir, err := SetupRuntimeDirectory(cfg, 1)
+ require.NoError(t, err)
+ expectedLogs[rootRuntimeDir] = "removing leftover runtime directory"
+ prunableDirs = append(prunableDirs, rootRuntimeDir)
+
// Create an unexpected file in the runtime directory
unexpectedFilePath := filepath.Join(baseDir, "unexpected-file")
require.NoError(t, os.WriteFile(unexpectedFilePath, []byte(""), os.ModePerm))