Debian Codegraph @

src/runtime/testdata/testgoroutineleakprofile/goker/moby36114.go

raw
1 // Copyright 2025 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a MIT
3 // license that can be found in the LICENSE file.
4
5 /*
6 * Project: moby
7 * Issue or PR : https://github.com/moby/moby/pull/36114
8 * Buggy version: 6d4d3c52ae7c3f910bfc7552a2a673a8338e5b9f
9 * fix commit-id: a44fcd3d27c06aaa60d8d1cbce169f0d982e74b1
10 * Flaky: 100/100
11 */
12 package main
13
14 import (
15 "os"
16 "runtime/pprof"
17 "sync"
18 "time"
19 )
20
21 func init() {
22 register("Moby36114", Moby36114)
23 }
24
25 type serviceVM_moby36114 struct {
26 sync.Mutex
27 }
28
29 func (svm *serviceVM_moby36114) hotAddVHDsAtStart() {
30 svm.Lock()
31 defer svm.Unlock()
32 svm.hotRemoveVHDsAtStart()
33 }
34
35 func (svm *serviceVM_moby36114) hotRemoveVHDsAtStart() {
36 svm.Lock()
37 defer svm.Unlock()
38 }
39
40 func Moby36114() {
41 prof := pprof.Lookup("goroutineleak")
42 defer func() {
43 time.Sleep(100 * time.Millisecond)
44 prof.WriteTo(os.Stdout, 2)
45 }()
46
47 for i := 0; i < 100; i++ {
48 go func() {
49 s := &serviceVM_moby36114{}
50 go s.hotAddVHDsAtStart()
51 }()
52 }
53 }