mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-18 18:38:08 -05:00
Stop copying sync.Maps, which is forbidden. (#24027)
This commit is contained in:
parent
b19562db9a
commit
7ec3867eea
2 changed files with 6 additions and 3 deletions
3
changelog/24027.txt
Normal file
3
changelog/24027.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
expiration: Fix fatal error "concurrent map iteration and map write" when collecting metrics from leases.
|
||||
```
|
||||
|
|
@ -879,7 +879,7 @@ func (m *ExpirationManager) Stop() error {
|
|||
// for the next ExpirationManager to handle them.
|
||||
newStrategy := ExpireLeaseStrategy(expireNoop)
|
||||
m.expireFunc.Store(&newStrategy)
|
||||
oldPending := m.pending
|
||||
oldPending := &m.pending
|
||||
m.pending, m.nonexpiring, m.irrevocable = sync.Map{}, sync.Map{}, sync.Map{}
|
||||
m.leaseCount = 0
|
||||
m.uniquePolicies = make(map[string][]string)
|
||||
|
|
@ -2485,7 +2485,7 @@ func (m *ExpirationManager) WalkTokens(walkFn ExpirationWalkFunction) error {
|
|||
}
|
||||
|
||||
m.pendingLock.RLock()
|
||||
toWalk := []sync.Map{m.pending, m.nonexpiring}
|
||||
toWalk := []*sync.Map{&m.pending, &m.nonexpiring}
|
||||
m.pendingLock.RUnlock()
|
||||
|
||||
for _, m := range toWalk {
|
||||
|
|
@ -2514,7 +2514,7 @@ func (m *ExpirationManager) walkLeases(walkFn leaseWalkFunction) error {
|
|||
}
|
||||
|
||||
m.pendingLock.RLock()
|
||||
toWalk := []sync.Map{m.pending, m.nonexpiring}
|
||||
toWalk := []*sync.Map{&m.pending, &m.nonexpiring}
|
||||
m.pendingLock.RUnlock()
|
||||
|
||||
for _, m := range toWalk {
|
||||
|
|
|
|||
Loading…
Reference in a new issue