Skip to content

Commit cf1109f

Browse files
committed
Goroutine leak tests updated to collect goroutine leak profiles.
1 parent 0ac1b47 commit cf1109f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+686
-574
lines changed

src/runtime/gc_test.go

100644100755
Lines changed: 335 additions & 335 deletions
Large diffs are not rendered by default.

src/runtime/testdata/testgoroutineleakgc/cockroach10214.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
package main
1212

1313
import (
14+
"os"
1415
"runtime"
16+
"runtime/pprof"
1517
"sync"
1618
"time"
1719
"unsafe"
@@ -98,9 +100,10 @@ func (r *Replica_cockroach10214) maybeCoalesceHeartbeat() bool {
98100
}
99101

100102
func Cockroach10214() {
103+
prof := pprof.Lookup("goroutineleak")
101104
defer func() {
102105
time.Sleep(100 * time.Millisecond)
103-
runtime.GC()
106+
prof.WriteTo(os.Stdout, 2)
104107
}()
105108
for i := 0; i < 1000; i++ {
106109
go func() {

src/runtime/testdata/testgoroutineleakgc/cockroach1055.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package main
22

33
import (
4-
"runtime"
4+
"os"
5+
"runtime/pprof"
56
"sync"
67
"sync/atomic"
78
"time"
@@ -70,9 +71,10 @@ func NewStopper_cockroach1055() *Stopper_cockroach1055 {
7071
}
7172

7273
func Cockroach1055() {
74+
prof := pprof.Lookup("goroutineleak")
7375
defer func() {
7476
time.Sleep(1 * time.Second)
75-
runtime.GC()
77+
prof.WriteTo(os.Stdout, 2)
7678
}()
7779

7880
for i := 0; i <= 1000; i++ {

src/runtime/testdata/testgoroutineleakgc/cockroach10790.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ package main
1414

1515
import (
1616
"context"
17-
"runtime"
17+
"os"
18+
"runtime/pprof"
1819
"sync"
1920
"time"
2021
)
@@ -107,9 +108,10 @@ func NewReplica_cockroach10790() *Replica_cockroach10790 {
107108
///
108109

109110
func Cockroach10790() {
111+
prof := pprof.Lookup("goroutineleak")
110112
defer func() {
111113
time.Sleep(100 * time.Millisecond)
112-
runtime.GC()
114+
prof.WriteTo(os.Stdout, 2)
113115
}()
114116

115117
for i := 0; i < 100; i++ {

src/runtime/testdata/testgoroutineleakgc/cockroach13197.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ package main
1111

1212
import (
1313
"context"
14-
"runtime"
14+
"os"
15+
"runtime/pprof"
1516
"time"
1617
)
1718

@@ -61,9 +62,10 @@ func (tx *Tx_cockroach13197) close() {
6162
/// -----------G2 leak-------------
6263

6364
func Cockroach13197() {
65+
prof := pprof.Lookup("goroutineleak")
6466
defer func() {
6567
time.Sleep(100 * time.Millisecond)
66-
runtime.GC()
68+
prof.WriteTo(os.Stdout, 2)
6769
}()
6870

6971
db := &DB_cockroach13197{}

src/runtime/testdata/testgoroutineleakgc/cockroach13755.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ package main
1313

1414
import (
1515
"context"
16-
"runtime"
16+
"os"
17+
"runtime/pprof"
1718
"time"
1819
)
1920

@@ -48,9 +49,10 @@ func (rs *Rows_cockroach13755) close(err error) {
4849
/// ---------------G2 leak-----------------
4950

5051
func Cockroach13755() {
52+
prof := pprof.Lookup("goroutineleak")
5153
defer func() {
5254
time.Sleep(100 * time.Millisecond)
53-
runtime.GC()
55+
prof.WriteTo(os.Stdout, 2)
5456
}()
5557

5658
rs := &Rows_cockroach13755{}

src/runtime/testdata/testgoroutineleakgc/cockroach1462.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package main
22

33
import (
4+
"os"
45
"runtime"
6+
"runtime/pprof"
57
"sync"
68
"time"
79
)
@@ -143,9 +145,10 @@ func processEventsUntil_cockroach1462(ch <-chan interceptMessage_cockroach1462,
143145
}
144146

145147
func Cockroach1462() {
148+
prof := pprof.Lookup("goroutineleak")
146149
defer func() {
147150
time.Sleep(2000 * time.Millisecond)
148-
runtime.GC()
151+
prof.WriteTo(os.Stdout, 2)
149152
}()
150153
for i := 0; i <= 1000; i++ {
151154
go func() { // G1

src/runtime/testdata/testgoroutineleakgc/cockroach16167.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
package main
1919

2020
import (
21+
"os"
2122
"runtime"
23+
"runtime/pprof"
2224
"sync"
2325
"time"
2426
)
@@ -103,9 +105,10 @@ func NewExectorAndSession_cockroach16167() (*Executor_cockroach16167, *Session_c
103105
/// ----------------------G1,G2 deadlock--------------------
104106

105107
func Cockroach16167() {
108+
prof := pprof.Lookup("goroutineleak")
106109
defer func() {
107110
time.Sleep(100 * time.Millisecond)
108-
runtime.GC()
111+
prof.WriteTo(os.Stdout, 2)
109112
}()
110113

111114
for i := 0; i < 100; i++ {

src/runtime/testdata/testgoroutineleakgc/cockroach18101.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ package main
1515

1616
import (
1717
"context"
18-
"runtime"
18+
"os"
19+
"runtime/pprof"
1920
"time"
2021
)
2122

@@ -61,9 +62,10 @@ func splitAndScatter_cockroach18101(ctx context.Context, readyForImportCh chan b
6162
///
6263

6364
func Cockroach18101() {
65+
prof := pprof.Lookup("goroutineleak")
6466
defer func() {
6567
time.Sleep(100 * time.Millisecond)
66-
runtime.GC()
68+
prof.WriteTo(os.Stdout, 2)
6769
}()
6870
for i := 0; i < 100; i++ {
6971
ctx, cancel := context.WithCancel(context.Background())

src/runtime/testdata/testgoroutineleakgc/cockroach2448.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package main
22

33
import (
4+
"os"
45
"runtime"
6+
"runtime/pprof"
57
"time"
68
)
79

@@ -102,9 +104,10 @@ func NewStoreAndState_cockroach2448() (*Store_cockroach2448, *state_cockroach244
102104
}
103105

104106
func Cockroach2448() {
107+
prof := pprof.Lookup("goroutineleak")
105108
defer func() {
106109
time.Sleep(time.Second)
107-
runtime.GC()
110+
prof.WriteTo(os.Stdout, 2)
108111
}()
109112
for i := 0; i < 1000; i++ {
110113
go func() {

0 commit comments

Comments
 (0)