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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-03-15 12:41:11 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-03-24 16:52:49 +0300
commite1f76b8dc923150a3f9f845fc93efd4e2d828b36 (patch)
treefefb4402172f3a895104cda7d54d8387180d86c6
parentde764b05589ec73e1aa9ddd2d7118ced301602f0 (diff)
lint: Move linting exceptions for calling kill inline
There's several locations where we don't verify that the `Kill()` syscall succeeded. Move the linting exceptions we have in our golangci-lint configuration inline to clearly indicate that this is something we may want to fix in the future.
-rw-r--r--.golangci.yml12
-rw-r--r--internal/command/command.go1
-rw-r--r--internal/gitaly/rubyserver/worker.go2
-rw-r--r--internal/supervisor/supervisor.go2
4 files changed, 5 insertions, 12 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 417897f8c..3030c72d7 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -81,18 +81,6 @@ issues:
- errcheck
path: "internal/middleware/limithandler/limithandler.go"
text: "Error return value of `limiter.Limit` is not checked"
- - linters:
- - errcheck
- path: "internal/supervisor/supervisor.go"
- text: "Error return value of `(cmd.Process.Kill)?` is not checked"
- - linters:
- - errcheck
- path: "internal/gitaly/rubyserver/worker.go"
- text: "Error return value of `syscall.Kill` is not checked"
- - linters:
- - errcheck
- path: "internal/command/command.go"
- text: "Error return value of `syscall.Kill` is not checked"
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
diff --git a/internal/command/command.go b/internal/command/command.go
index ccf13d291..ba964209a 100644
--- a/internal/command/command.go
+++ b/internal/command/command.go
@@ -254,6 +254,7 @@ func New(ctx context.Context, cmd *exec.Cmd, stdin io.Reader, stdout, stderr io.
<-ctx.Done()
if process := cmd.Process; process != nil && process.Pid > 0 {
+ //nolint:errcheck // TODO: do we want to report errors?
// Send SIGTERM to the process group of cmd
syscall.Kill(-process.Pid, syscall.SIGTERM)
}
diff --git a/internal/gitaly/rubyserver/worker.go b/internal/gitaly/rubyserver/worker.go
index ba2b76197..f3dd20aa0 100644
--- a/internal/gitaly/rubyserver/worker.go
+++ b/internal/gitaly/rubyserver/worker.go
@@ -217,10 +217,12 @@ func (w *worker) waitTerminate(pid int) {
terminationCounter.WithLabelValues(w.Name).Inc()
w.logPid(pid).Info("sending SIGTERM")
+ //nolint:errcheck // TODO: do we want to report errors?
syscall.Kill(pid, syscall.SIGTERM)
time.Sleep(w.gracefulRestartTimeout)
w.logPid(pid).Info("sending SIGKILL")
+ //nolint:errcheck // TODO: do we want to report errors?
syscall.Kill(pid, syscall.SIGKILL)
}
diff --git a/internal/supervisor/supervisor.go b/internal/supervisor/supervisor.go
index 9c90866ae..f695b071e 100644
--- a/internal/supervisor/supervisor.go
+++ b/internal/supervisor/supervisor.go
@@ -200,6 +200,8 @@ spawnLoop:
break waitLoop
case <-p.shutdown:
if cmd.Process != nil {
+ //nolint:errcheck // TODO: do we want to report
+ // errors?
cmd.Process.Kill()
}
<-waitCh