raft/autopilot: fix panic during autopilot shutdown (#27726)

* raft/autopilot: fix panic during autopilot shutdown

* changelog
This commit is contained in:
Jason O'Donnell
2024-07-09 12:52:40 -04:00
committed by GitHub
parent 0dc041625e
commit 2a09bd47ba
2 changed files with 5 additions and 1 deletions

3
changelog/27726.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
raft/autopilot: Fixed panic that may occur during shutdown
```

View File

@@ -636,7 +636,8 @@ func (b *RaftBackend) StopAutopilot() {
if b.autopilot == nil { if b.autopilot == nil {
return return
} }
b.autopilot.Stop() stopCh := b.autopilot.Stop()
<-stopCh
b.autopilot = nil b.autopilot = nil
b.followerHeartbeatTicker.Stop() b.followerHeartbeatTicker.Stop()
} }