From 71a237042a9c39a45bc8f9c76465e5ff6039eba9 Mon Sep 17 00:00:00 2001 From: Lucas Manuel Rodriguez Date: Wed, 4 Oct 2023 09:10:16 -0300 Subject: [PATCH] Add continues to not crash with panics on connection errors (#14223) I found a few panics in osquery-perf while working in load testing #13287. These panic happened due to e.g. network errors. --- cmd/osquery-perf/agent.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/osquery-perf/agent.go b/cmd/osquery-perf/agent.go index 3507ae6e5b..19992886cf 100644 --- a/cmd/osquery-perf/agent.go +++ b/cmd/osquery-perf/agent.go @@ -551,6 +551,7 @@ func (a *agent) runOrbitLoop() { if err != nil { a.stats.IncrementOrbitErrors() log.Println("orbitClient.GetConfig: ", err) + continue } if len(cfg.Notifications.PendingScriptExecutionIDs) > 0 { // there are pending scripts to execute on this host, start a goroutine @@ -562,6 +563,7 @@ func (a *agent) runOrbitLoop() { if err := deviceClient.CheckToken(*a.deviceAuthToken); err != nil { a.stats.IncrementOrbitErrors() log.Println("deviceClient.CheckToken: ", err) + continue } } case <-orbitTokenRotationTicker: @@ -570,6 +572,7 @@ func (a *agent) runOrbitLoop() { if err := orbitClient.SetOrUpdateDeviceToken(*newToken); err != nil { a.stats.IncrementOrbitErrors() log.Println("orbitClient.SetOrUpdateDeviceToken: ", err) + continue } a.deviceAuthToken = newToken // fleet desktop performs a burst of check token requests after a token is rotated @@ -579,11 +582,13 @@ func (a *agent) runOrbitLoop() { if err := orbitClient.Ping(); err != nil { a.stats.IncrementOrbitErrors() log.Println("orbitClient.Ping: ", err) + continue } case <-fleetDesktopPolicyTicker: if _, err := deviceClient.DesktopSummary(*a.deviceAuthToken); err != nil { a.stats.IncrementDesktopErrors() log.Println("deviceClient.NumberOfFailingPolicies: ", err) + continue } } }