Skip to content

Commit

Permalink
make listeners recover from panics
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Nov 22, 2023
1 parent f34c015 commit 15fcb1b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/snclient/snclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,16 @@ func (snc *Agent) logPanicExit() {
}
}

func (snc *Agent) logPanicRecover() {
if r := recover(); r != nil {
log.Errorf("********* PANIC *********")
log.Errorf("Panic: %s", r)
log.Errorf("**** Stack:")
log.Errorf("%s", debug.Stack())
log.Errorf("*************************")
}
}

// RunCheck calls check by name and returns the check result
func (snc *Agent) RunCheck(name string, args []string) *CheckResult {
ctx, cancel := context.WithTimeout(context.TODO(), 60*time.Second)
Expand Down

0 comments on commit 15fcb1b

Please sign in to comment.