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:
authorJohn Cai <jcai@gitlab.com>2022-03-08 19:54:40 +0300
committerJohn Cai <jcai@gitlab.com>2022-03-08 19:55:47 +0300
commitac24add628cfdd58b5e0fedb5fb31ab7a696b8d9 (patch)
tree983850000fc1babc41654eb5cacee05edc0a4bb9
parenta928ebb0951f52bfccbfc2e67543abe8bc3f3963 (diff)
cgroups: Remove paths fieldjc-fix-cgroups-memory-race
The paths field on the CgroupV1Manager was being accessed concurrently, leading to a panic. However, this field is not actually used by anything. Fix this issue by removing the field. Changelog: fixed
-rw-r--r--internal/cgroups/v1_linux.go4
-rw-r--r--internal/cgroups/v1_linux_test.go2
2 files changed, 0 insertions, 6 deletions
diff --git a/internal/cgroups/v1_linux.go b/internal/cgroups/v1_linux.go
index 56a710644..66a4de23a 100644
--- a/internal/cgroups/v1_linux.go
+++ b/internal/cgroups/v1_linux.go
@@ -18,7 +18,6 @@ import (
type CGroupV1Manager struct {
cfg cgroupscfg.Config
hierarchy func() ([]cgroups.Subsystem, error)
- paths map[string]interface{}
memoryFailedTotal, cpuUsage *prometheus.GaugeVec
procs *prometheus.GaugeVec
}
@@ -29,7 +28,6 @@ func newV1Manager(cfg cgroupscfg.Config) *CGroupV1Manager {
hierarchy: func() ([]cgroups.Subsystem, error) {
return defaultSubsystems(cfg.Mountpoint)
},
- paths: make(map[string]interface{}),
memoryFailedTotal: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "gitaly_cgroup_memory_failed_total",
@@ -102,8 +100,6 @@ func (cg *CGroupV1Manager) AddCommand(cmd *command.Command) error {
return fmt.Errorf("failed adding process to cgroup: %w", err)
}
- cg.paths[cgroupPath] = struct{}{}
-
return nil
}
diff --git a/internal/cgroups/v1_linux_test.go b/internal/cgroups/v1_linux_test.go
index e0236cefb..34defbf8e 100644
--- a/internal/cgroups/v1_linux_test.go
+++ b/internal/cgroups/v1_linux_test.go
@@ -67,7 +67,6 @@ func TestAddCommand(t *testing.T) {
v1Manager1 := &CGroupV1Manager{
cfg: config,
hierarchy: mock.hierarchy,
- paths: make(map[string]interface{}),
}
require.NoError(t, v1Manager1.Setup())
ctx := testhelper.Context(t)
@@ -80,7 +79,6 @@ func TestAddCommand(t *testing.T) {
v1Manager2 := &CGroupV1Manager{
cfg: config,
hierarchy: mock.hierarchy,
- paths: make(map[string]interface{}),
}
require.NoError(t, v1Manager2.AddCommand(cmd2))