From a0e0b1861d5b2d0d77e728042c915f5b7742e744 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Tue, 25 Apr 2023 22:55:58 -0400 Subject: [Bugfix] Tighten up check for probe connection reuse Even with previous fixes it was *still* possible for a self-down probe to have started before the underlying load-generating connection came online (or so it seems!). This patch will move changing the status of an underlying lgc from not-running state to running state even later to eliminate even the smallest possible gap. Re: #47 --- rpm/rpm.go | 60 ++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 22 deletions(-) (limited to 'rpm') diff --git a/rpm/rpm.go b/rpm/rpm.go index 99a52b6..c900642 100644 --- a/rpm/rpm.go +++ b/rpm/rpm.go @@ -158,30 +158,46 @@ func CombinedProber( ) // Start Self Download Connection Prober - go probe.Probe( - networkActivityCtx, - &wg, - selfDownProbeConnection.Client(), - selfProbeConfiguration.URL, - selfProbeConfiguration.Host, - probe.SelfDown, - &dataPoints, - captureExtendedStats, - debugging, - ) + + // TODO: Make the following sanity check more than just a check. + // We only want to start a SelfDown probe on a connection that is + // in the RUNNING state. + if selfDownProbeConnection.Status() == lgc.LGC_STATUS_RUNNING { + go probe.Probe( + networkActivityCtx, + &wg, + selfDownProbeConnection.Client(), + selfProbeConfiguration.URL, + selfProbeConfiguration.Host, + probe.SelfDown, + &dataPoints, + captureExtendedStats, + debugging, + ) + } else { + panic(fmt.Sprintf("(%s) Combined probe driver evidently lost its underlying connection (Status: %v).\n", debugging.Prefix, selfDownProbeConnection.Status())) + } // Start Self Upload Connection Prober - go probe.Probe( - proberCtx, - &wg, - selfUpProbeConnection.Client(), - selfProbeConfiguration.URL, - selfProbeConfiguration.Host, - probe.SelfUp, - &dataPoints, - captureExtendedStats, - debugging, - ) + + // TODO: Make the following sanity check more than just a check. + // We only want to start a SelfDown probe on a connection that is + // in the RUNNING state. + if selfUpProbeConnection.Status() == lgc.LGC_STATUS_RUNNING { + go probe.Probe( + proberCtx, + &wg, + selfUpProbeConnection.Client(), + selfProbeConfiguration.URL, + selfProbeConfiguration.Host, + probe.SelfUp, + &dataPoints, + captureExtendedStats, + debugging, + ) + } else { + panic(fmt.Sprintf("(%s) Combined probe driver evidently lost its underlying connection (Status: %v).\n", debugging.Prefix, selfUpProbeConnection.Status())) + } } if debug.IsDebug(debugging.Level) { fmt.Printf( -- cgit v1.2.3