From 78b88fa490ee13dad6c85a018525c268aed4b6d3 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 12 Jul 2024 12:23:57 +0200 Subject: syz-manager: query hub only after finishing the previous batch It does happen that we see a long tail of "candidate triage jobs" during a big influx of syz-hub programs. This is bad because in 10 minutes we'll query another batch, which will further stretch the triage process. By delaying the process more and more we're offloading the start of bug reproduction, so let's control the hub sync process more carefully - only perform the next query after the previous batch has completed. --- syz-manager/hub.go | 3 ++- syz-manager/manager.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/syz-manager/hub.go b/syz-manager/hub.go index e7914e37f..ba3a14ad3 100644 --- a/syz-manager/hub.go +++ b/syz-manager/hub.go @@ -94,6 +94,7 @@ type HubConnector struct { type HubManagerView interface { getMinimizedCorpus() (corpus []*corpus.Item, repros [][]byte) addNewCandidates(candidates []fuzzer.Candidate) + needMoreCandidates() bool hubIsUnreachable() } @@ -111,7 +112,7 @@ func (hc *HubConnector) loop() { log.Logf(0, "connected to hub at %v, corpus %v", hc.cfg.HubAddr, len(corpus)) } } - if hub != nil { + if hub != nil && hc.mgr.needMoreCandidates() { if err := hc.sync(hub, corpus); err != nil { log.Logf(0, "hub sync failed: %v", err) hub.Close() diff --git a/syz-manager/manager.go b/syz-manager/manager.go index faaf19965..dbd80c063 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -1499,6 +1499,10 @@ func (mgr *Manager) fuzzerLoop(fuzzer *fuzzer.Fuzzer) { } } +func (mgr *Manager) needMoreCandidates() bool { + return mgr.fuzzer.Load().CandidateTriageFinished() +} + func (mgr *Manager) hubIsUnreachable() { var dash *dashapi.Dashboard mgr.mu.Lock() -- cgit mrf-deployment