Skip to content

Commit

Permalink
Merge #131176
Browse files Browse the repository at this point in the history
131176: roachtest: prevent leaked goroutine in mvccgc roachtest r=tbg a=tbg

Noticed while looking at the artifacts for an unrelated
test failure:

```
goroutine 686898 [chan send, 446 minutes]:
github.com/cockroachdb/cockroach/pkg/cmd/roachtest/tests.runMVCCGC.func3.1()
        github.com/cockroachdb/cockroach/pkg/cmd/roachtest/tests/mvcc_gc.go:153 +0x85e
created by github.com/cockroachdb/cockroach/pkg/cmd/roachtest/tests.runMVCCGC.func3 in goroutine 686834
        github.com/cockroachdb/cockroach/pkg/cmd/roachtest/tests/mvcc_gc.go:142 +0x689
```

This is because the test doesn't consume from this unbuffered channel,
thereby leaking the worker goroutine forever.

Making the result channel 1-buffered avoids this problem.

Epic: none
Release note: None


Co-authored-by: Tobias Grieger <[email protected]>
  • Loading branch information
craig[bot] and tbg committed Sep 25, 2024
2 parents 59061df + 7a52ef6 commit e1b5321
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/mvcc_gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func runMVCCGC(ctx context.Context, t test.Test, c cluster.Cluster) {

wlCtx, wlCancel := context.WithCancel(ctx)
defer wlCancel()
wlFailure := make(chan error)
wlFailure := make(chan error, 1)
go func() {
defer close(wlFailure)
cmd = roachtestutil.NewCommand("./cockroach workload run kv").
Expand Down

0 comments on commit e1b5321

Please sign in to comment.