From 84ff0738c79d3418a152a45abece5566043c8ae3 Mon Sep 17 00:00:00 2001 From: Andrei Matei Date: Thu, 16 Dec 2021 15:54:44 -0500 Subject: [PATCH] roachtest: make crdb crash on span-use-after-Finish This patch makes roachtest pass an env var to crdb asking it to panic on mis-use of tracing spans. I've been battling such bugs, which become more problematic as I'm trying to introduce span reuse. In production we'll probably continue tolerating such bugs for the time being, but I want tests to yell. Unit tests are already running with this use-after-Finish detection, and so far so good. I've done a manual run of all the roachtests in this configuration and nothing crashed, so I don't expect a tragedy. Release note: None --- pkg/cmd/roachtest/cluster.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/cluster.go b/pkg/cmd/roachtest/cluster.go index af88386aaad0..f23adedb2617 100644 --- a/pkg/cmd/roachtest/cluster.go +++ b/pkg/cmd/roachtest/cluster.go @@ -1835,6 +1835,23 @@ func (c *clusterImpl) StartE(ctx context.Context, opts ...option.Option) error { } } } + + // Set some env vars. The first two also the default for `roachprod start`, + // but we have to add them so that the third one doesn't wipe them out. + if !argExists(args, "COCKROACH_ENABLE_RPC_COMPRESSION") { + // RPC compressions costs around 5% on kv95, so we disable it. It might help + // when moving snapshots around, though. + args = append(args, "--env=COCKROACH_ENABLE_RPC_COMPRESSION=false") + } + if !argExists(args, "COCKROACH_UI_RELEASE_NOTES_SIGNUP_DISMISSED") { + // Get rid of an annoying popup in the UI. + args = append(args, "--env=COCKROACH_UI_RELEASE_NOTES_SIGNUP_DISMISSED=true") + } + if !argExists(args, "COCKROACH_CRASH_ON_SPAN_USE_AFTER_FINISH") { + // Panic on span use-after-Finish, so we catch such bugs. + args = append(args, "--env=COCKROACH_CRASH_ON_SPAN_USE_AFTER_FINISH=true") + } + if err := execCmd(ctx, c.l, args...); err != nil { return err } @@ -1876,7 +1893,7 @@ func (c *clusterImpl) Start(ctx context.Context, opts ...option.Option) { func argExists(args []string, target string) bool { for _, arg := range args { - if arg == target || strings.HasPrefix(arg, target+"=") { + if arg == target || strings.HasPrefix(arg, target+"=") || strings.HasPrefix(arg, "--env="+target+"=") { return true } }