Skip to content

Commit

Permalink
bug: prevent go routine leakage due to existing DeferCheck (#18558)
Browse files Browse the repository at this point in the history
* bug: prevent go routine leakage due to existing DeferCheck

* add changelog
  • Loading branch information
huikang authored Aug 23, 2023
1 parent a1cd3f8 commit b37587b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/18558.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
check: prevent go routine leakage when existing Defercheck of same check id is not nil
```
6 changes: 6 additions & 0 deletions agent/local/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,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
Expand Down

0 comments on commit b37587b

Please sign in to comment.