Skip to content

Commit

Permalink
Fix concurrent map writes in integration network shutdown (#2410)
Browse files Browse the repository at this point in the history
  • Loading branch information
karimodm authored Aug 31, 2022
1 parent c9029d3 commit a19d286
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/integration-tests/tester/framework/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"sync"
"time"

"github.com/cockroachdb/errors"
Expand Down Expand Up @@ -219,10 +220,13 @@ func (n *Network) Shutdown(ctx context.Context) error {

// stop all peers in parallel
var eg errgroup.Group
var exitStatusMutex sync.Mutex
for _, peer := range n.peers {
peer := peer // capture range variable
eg.Go(func() error {
status, err := peer.Shutdown(ctx)
exitStatusMutex.Lock()
defer exitStatusMutex.Unlock()
exitStatus[peer.Name()] = status
return err
})
Expand Down

0 comments on commit a19d286

Please sign in to comment.