From 05c8a9e2ea4c9573a764d917425cca0f89ddfa05 Mon Sep 17 00:00:00 2001 From: Andrew Werner Date: Wed, 25 Sep 2019 13:13:08 -0400 Subject: [PATCH] roachtest: fix panic when tests fail using an existing cluster ``` panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x61498e6] goroutine 67 [running]: github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).Recover(0xc0000e9560, 0x7942500, 0xc0005beb10) /Users/lucy/go/src/github.com/cockroachdb/cockroach/pkg/util/stop/stopper.go:181 +0x121 panic(0x6ce8ee0, 0x9b12c10) /usr/local/go/src/runtime/panic.go:522 +0x1b5 github.com/cockroachdb/cockroach/pkg/util/quotapool.(*IntAlloc).Freeze(0x0) ``` Release justification: Not production code. Release note: None --- pkg/cmd/roachtest/cluster.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/cluster.go b/pkg/cmd/roachtest/cluster.go index 4bdc53e742b9..ca28ca8f8866 100644 --- a/pkg/cmd/roachtest/cluster.go +++ b/pkg/cmd/roachtest/cluster.go @@ -1071,7 +1071,9 @@ func (c *cluster) setTest(t testI) { func (c *cluster) Save(ctx context.Context, msg string, l *logger) { l.PrintfCtx(ctx, "saving cluster %s for debugging (--debug specified)", c) // TODO(andrei): should we extend the cluster here? For how long? - c.destroyState.alloc.Freeze() + if c.destroyState.owned { // we won't have an alloc for an unowned cluster + c.destroyState.alloc.Freeze() + } c.r.markClusterAsSaved(c, msg) c.destroyState.mu.Lock() c.destroyState.mu.saved = true