Skip to content

Commit

Permalink
sweet: ignore ErrProcessDone from SIGKILL to cockroachdb instances
Browse files Browse the repository at this point in the history
Sending SIGKILL is racy with the program exiting normally via SIGTERM.
If this happens, we might see ErrProcessDone, which is safe to ignore.
Seen at least once on the builders.

Change-Id: Iab8190e46e4d9f00c6ef059909feca92aaaa798e
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/615135
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
  • Loading branch information
mknyszek authored and gopherbot committed Sep 24, 2024
1 parent 9b3f4a5 commit ffe4d68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sweet/benchmarks/cockroachdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ func (i *cockroachdbInstance) shutdown() (killed bool, err error) {
case <-time.After(1 * time.Minute):
// If it takes a full minute to shut down, just kill the instance
// and report that we did it. We *probably* won't need it again.
if err := i.cmd.Process.Signal(syscall.SIGKILL); err != nil {
// We're also racing here with the process exiting, so we could see
// ErrProcessDone; ignore it if we do.
if err := i.cmd.Process.Signal(syscall.SIGKILL); err != nil && !errors.Is(err, os.ErrProcessDone) {
return false, fmt.Errorf("failed to send SIGKILL to instance %s: %v", i.name, err)
}
killed = true
Expand Down

0 comments on commit ffe4d68

Please sign in to comment.