Skip to content

Commit

Permalink
Merge #114594
Browse files Browse the repository at this point in the history
114594: roachtest: always send SIGKILL after SIGUSR1 r=RaduBerinde a=RaduBerinde

In coverage mode we send SIGUSR1 instead of SIGKILL so that we can
obtain the coverage data. However, upgrade tests use older Cockroach
versions which ignore SIGUSR1.

With this change we now always send SIGKILL if SIGUSR1 did not end the
process.

Epic: none
Release note: None

Fixes #114558
Fixes #114562

Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
  • Loading branch information
craig[bot] and RaduBerinde committed Nov 17, 2023
2 parents dcedaf1 + 46e9c19 commit 7f00287
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pkg/cmd/roachtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2079,17 +2079,20 @@ func (c *clusterImpl) StopE(
if c.spec.NodeCount == 0 {
return nil // unit tests
}
if c.goCoverDir != "" {
// Never kill processes if we're trying to collect coverage; use SIGUSR1
// which dumps coverage data and exits.
if stopOpts.RoachprodOpts.Sig == 9 {
stopOpts.RoachprodOpts.Sig = 10 // SIGUSR1
stopOpts.RoachprodOpts.Wait = true
stopOpts.RoachprodOpts.MaxWait = 10
}
}
c.setStatusForClusterOpt("stopping", stopOpts.RoachtestOpts.Worker, nodes...)
defer c.clearStatusForClusterOpt(stopOpts.RoachtestOpts.Worker)

if c.goCoverDir != "" && stopOpts.RoachprodOpts.Sig == 9 /* SIGKILL */ {
// If we are trying to collect coverage, we don't want to kill processes;
// use SIGUSR1 which dumps coverage data and exits. Note that Cockroach
// v23.1 and earlier ignore SIGUSR1, so we still want to send SIGKILL.
l.Printf("coverage mode: first trying to stop using SIGUSR1")
opts := stopOpts.RoachprodOpts
opts.Sig = 10 // SIGUSR1
opts.Wait = true
opts.MaxWait = 10
_ = roachprod.Stop(ctx, l, c.MakeNodes(nodes...), opts)
}
return errors.Wrap(roachprod.Stop(ctx, l, c.MakeNodes(nodes...), stopOpts.RoachprodOpts), "cluster.StopE")
}

Expand Down

0 comments on commit 7f00287

Please sign in to comment.