mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
Fix race that can lead to panic during seal (#23906)
* Fix race that can lead to panic during seal * Add changelog
This commit is contained in:
3
changelog/23906.txt
Normal file
3
changelog/23906.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
core: fix rare panic due to a race condition with metrics collection during seal
|
||||||
|
```
|
||||||
@@ -597,14 +597,14 @@ func (c *Core) inFlightReqGaugeMetric() {
|
|||||||
|
|
||||||
// configuredPoliciesGaugeCollector is used to collect gauge label values for the `vault.policy.configured.count` metric
|
// configuredPoliciesGaugeCollector is used to collect gauge label values for the `vault.policy.configured.count` metric
|
||||||
func (c *Core) configuredPoliciesGaugeCollector(ctx context.Context) ([]metricsutil.GaugeLabelValues, error) {
|
func (c *Core) configuredPoliciesGaugeCollector(ctx context.Context) ([]metricsutil.GaugeLabelValues, error) {
|
||||||
if c.policyStore == nil {
|
|
||||||
return []metricsutil.GaugeLabelValues{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
c.stateLock.RLock()
|
c.stateLock.RLock()
|
||||||
policyStore := c.policyStore
|
policyStore := c.policyStore
|
||||||
c.stateLock.RUnlock()
|
c.stateLock.RUnlock()
|
||||||
|
|
||||||
|
if policyStore == nil {
|
||||||
|
return []metricsutil.GaugeLabelValues{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
ctx = namespace.RootContext(ctx)
|
ctx = namespace.RootContext(ctx)
|
||||||
namespaces := c.collectNamespaces()
|
namespaces := c.collectNamespaces()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user