mirror of https://github.com/status-im/consul.git
fix race when starting a service while the agent `serviceManager` is … (#12302)
* fix race when starting a service while the agent `serviceManager` is stopping * add changelog
This commit is contained in:
parent
955ac1fc51
commit
4f0a71d7b4
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
Fix a data race when a service is added while the agent is shutting down..
|
||||
```
|
|
@ -1368,14 +1368,14 @@ func (a *Agent) ShutdownAgent() error {
|
|||
// this should help them to be stopped more quickly
|
||||
a.baseDeps.AutoConfig.Stop()
|
||||
|
||||
a.stateLock.Lock()
|
||||
defer a.stateLock.Unlock()
|
||||
// Stop the service manager (must happen before we take the stateLock to avoid deadlock)
|
||||
if a.serviceManager != nil {
|
||||
a.serviceManager.Stop()
|
||||
}
|
||||
|
||||
// Stop all the checks
|
||||
a.stateLock.Lock()
|
||||
defer a.stateLock.Unlock()
|
||||
for _, chk := range a.checkMonitors {
|
||||
chk.Stop()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue