| 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/25384 |
| 8 |
* Buggy version: 58befe3081726ef74ea09198cd9488fb42c51f51 |
| 9 |
* fix commit-id: 42360d164b9f25fb4b150ef066fcf57fa39559a7 |
| 10 |
* Flaky: 100/100 |
| 11 |
*/ |
| 12 |
package main |
| 13 |
|
| 14 |
import ( |
| 15 |
"os" |
| 16 |
"runtime" |
| 17 |
"runtime/pprof" |
| 18 |
"sync" |
| 19 |
) |
| 20 |
|
| 21 |
func init() { |
| 22 |
register("Moby25348", Moby25348) |
| 23 |
} |
| 24 |
|
| 25 |
type plugin_moby25348 struct{} |
| 26 |
|
| 27 |
type Manager_moby25348 struct { |
| 28 |
plugins []*plugin_moby25348 |
| 29 |
} |
| 30 |
|
| 31 |
func (pm *Manager_moby25348) init() { |
| 32 |
var group sync.WaitGroup |
| 33 |
group.Add(len(pm.plugins)) |
| 34 |
for _, p := range pm.plugins { |
| 35 |
go func(p *plugin_moby25348) { |
| 36 |
defer group.Done() |
| 37 |
}(p) |
| 38 |
group.Wait() // Block here |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
func Moby25348() { |
| 43 |
prof := pprof.Lookup("goroutineleak") |
| 44 |
defer func() { |
| 45 |
// Yield several times to allow the child goroutine to run. |
| 46 |
for i := 0; i < yieldCount; i++ { |
| 47 |
runtime.Gosched() |
| 48 |
} |
| 49 |
prof.WriteTo(os.Stdout, 2) |
| 50 |
}() |
| 51 |
go func() { |
| 52 |
p1 := &plugin_moby25348{} |
| 53 |
p2 := &plugin_moby25348{} |
| 54 |
pm := &Manager_moby25348{ |
| 55 |
plugins: []*plugin_moby25348{p1, p2}, |
| 56 |
} |
| 57 |
go pm.init() |
| 58 |
}() |
| 59 |
} |