Skip to content

Commit

Permalink
Prevent osquery instance restarts while instance is still launching (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany authored Jul 16, 2024
1 parent 6e482b0 commit 2de0df2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/osquery/runtime/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ func New(k types.Knapsack, opts ...OsqueryInstanceOption) *Runner {
}

func (r *Runner) Run() error {
// Ensure we don't try to restart the instance before it's launched
r.instanceLock.Lock()
if err := r.launchOsqueryInstance(); err != nil {
r.instanceLock.Unlock()
return fmt.Errorf("starting instance: %w", err)
}
r.instanceLock.Unlock()

// This loop waits for the completion of the async routines,
// and either restarts the instance (if Shutdown was not
Expand Down

0 comments on commit 2de0df2

Please sign in to comment.