mirror of https://github.com/hashicorp/consul
Backport of bug: prevent go routine leakage due to existing DeferCheck into release/1.15.x (#18564)
* backport of commitpull/18569/head06d4c72f68
* backport of commit42c37bb2c1
--------- Co-authored-by: cskh <hui.kang@hashicorp.com>
parent
5c46e020b2
commit
d738be6aa8
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
check: prevent go routine leakage when existing Defercheck of same check id is not nil
|
||||
```
|
|
@ -834,6 +834,12 @@ func (l *State) setCheckStateLocked(c *CheckState) {
|
|||
existing := l.checks[id]
|
||||
if existing != nil {
|
||||
c.InSync = c.Check.IsSame(existing.Check)
|
||||
// If the existing check has a Defercheck, it needs to be
|
||||
// assigned to the new check
|
||||
if existing.DeferCheck != nil && c.DeferCheck == nil {
|
||||
c.DeferCheck = existing.DeferCheck
|
||||
c.InSync = false
|
||||
}
|
||||
}
|
||||
|
||||
l.checks[id] = c
|
||||
|
|
Loading…
Reference in New Issue