mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
Speculative fix for a panic that might arise during raft teardown (#18704)
This commit is contained in:
parent
e36690e067
commit
98259ce53b
2 changed files with 10 additions and 0 deletions
3
changelog/18704.txt
Normal file
3
changelog/18704.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
storage/raft: Fix race with follower heartbeat tracker during teardown.
|
||||
```
|
||||
|
|
@ -551,6 +551,13 @@ func (b *RaftBackend) startFollowerHeartbeatTracker() {
|
|||
}
|
||||
for range tickerCh {
|
||||
b.l.RLock()
|
||||
if b.raft == nil {
|
||||
// We could be racing with teardown, which will stop the ticker
|
||||
// but that doesn't guarantee that we won't reach this line with a nil
|
||||
// b.raft.
|
||||
b.l.RUnlock()
|
||||
return
|
||||
}
|
||||
b.followerStates.l.RLock()
|
||||
myAppliedIndex := b.raft.AppliedIndex()
|
||||
for peerID, state := range b.followerStates.followers {
|
||||
|
|
|
|||
Loading…
Reference in a new issue