From 7a52ef67b12fc62ad22fb5ff1e4d1baa94ca0afa Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 23 Sep 2024 09:07:42 +0200 Subject: [PATCH] roachtest: prevent leaked goroutine in mvccgc roachtest 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 --- pkg/cmd/roachtest/tests/mvcc_gc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/tests/mvcc_gc.go b/pkg/cmd/roachtest/tests/mvcc_gc.go index 3206ce3ef4c5..ec1f83f85a14 100644 --- a/pkg/cmd/roachtest/tests/mvcc_gc.go +++ b/pkg/cmd/roachtest/tests/mvcc_gc.go @@ -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").