File: engine-disable-leak-workaround.patch

package info (click to toggle)
docker.io 27.5.1%2Bdfsg3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 67,780 kB
  • sloc: sh: 5,847; makefile: 1,146; ansic: 664; python: 162; asm: 133
file content (82 lines) | stat: -rw-r--r-- 2,575 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From: Reinhard Tartler <siretart@tauware.de>
Description: Disable workaround for OTEL memory leak

In debian, turns out that this test now triggers on all architectures, which
indicates that the workaround is no longer needed.

Index: docker.io/engine/cmd/dockerd/daemon_test.go
===================================================================
--- docker.io.orig/engine/cmd/dockerd/daemon_test.go
+++ docker.io/engine/cmd/dockerd/daemon_test.go
@@ -1,14 +1,12 @@
 package main
 
 import (
-	"runtime"
 	"testing"
 
 	"github.com/containerd/log"
 	"github.com/docker/docker/daemon/config"
 	"github.com/google/go-cmp/cmp/cmpopts"
 	"github.com/spf13/pflag"
-	"go.opentelemetry.io/otel"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	"gotest.tools/v3/fs"
@@ -286,29 +284,3 @@ func TestCDISpecDirs(t *testing.T) {
 		})
 	}
 }
-
-// TestOtelMeterLeak tests for a memory leak in the OTEL meter implementation.
-// Once the fixed OTEL is vendored, this test will fail - the workaround
-// and this test should be removed then.
-func TestOtelMeterLeak(t *testing.T) {
-	meter := otel.Meter("foo")
-
-	var before runtime.MemStats
-	runtime.ReadMemStats(&before)
-
-	const counters = 10 * 1000 * 1000
-	for i := 0; i < counters; i++ {
-		_, _ = meter.Int64Counter("bar")
-	}
-
-	var after runtime.MemStats
-	runtime.ReadMemStats(&after)
-
-	allocs := after.Mallocs - before.Mallocs
-	t.Log("Allocations:", allocs)
-
-	if allocs < 10 {
-		// TODO: Remove Workaround OTEL memory leak in cmd/dockerd/daemon.go
-		t.Fatal("Allocations count decreased. OTEL leak workaround is no longer needed!")
-	}
-}
Index: docker.io/engine/cmd/dockerd/docker.go
===================================================================
--- docker.io.orig/engine/cmd/dockerd/docker.go
+++ docker.io/engine/cmd/dockerd/docker.go
@@ -14,9 +14,6 @@ import (
 	"github.com/moby/sys/reexec"
 	"github.com/moby/term"
 	"github.com/spf13/cobra"
-
-	"go.opentelemetry.io/otel"
-	"go.opentelemetry.io/otel/metric/noop"
 )
 
 var honorXDG bool
@@ -85,12 +82,6 @@ func main() {
 	// Fixes https://github.com/docker/docker/issues/19728
 	signal.Ignore(syscall.SIGPIPE)
 
-	// Workaround OTEL memory leak
-	// See: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5190
-	// The need for this workaround is checked by the TestOtelMeterLeak test
-	// TODO: Remove this workaround after upgrading to v1.30.0
-	otel.SetMeterProvider(noop.MeterProvider{})
-
 	// Set terminal emulation based on platform as required.
 	_, stdout, stderr := term.StdStreams()
 	onError := func(err error) {