diff options
| author | Will Hawkins <[email protected]> | 2023-05-23 00:04:04 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2023-05-23 00:04:04 -0400 |
| commit | d4a0d400be96b8dda43096d41bdd6a1fc1fd4245 (patch) | |
| tree | 54e2d41add55840af2b3b28379d562bc85c16a62 | |
| parent | b0ebad5427f6378d2b1923cba59d357efeb86a1b (diff) | |
Additional debugging around non-reused connections
When a probe does not properly reuse an existing connection, do some
additional logging to help the debugging process.
| -rw-r--r-- | probe/probe.go | 13 | ||||
| -rw-r--r-- | rpm/rpm.go | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/probe/probe.go b/probe/probe.go index 5777bb3..3a38e3f 100644 --- a/probe/probe.go +++ b/probe/probe.go @@ -20,11 +20,13 @@ import ( "io" "net/http" "net/http/httptrace" + "os" "sync" "time" "github.com/network-quality/goresponsiveness/debug" "github.com/network-quality/goresponsiveness/extendedstats" + "github.com/network-quality/goresponsiveness/lgc" "github.com/network-quality/goresponsiveness/utilities" ) @@ -74,6 +76,7 @@ func Probe( managingCtx context.Context, waitGroup *sync.WaitGroup, client *http.Client, + lgc lgc.LoadGeneratingConnection, probeUrl string, probeHost string, // optional: for use with a test_endpoint probeType ProbeType, @@ -81,7 +84,6 @@ func Probe( captureExtendedStats bool, debugging *debug.DebugWithPrefix, ) error { - if waitGroup != nil { waitGroup.Add(1) defer waitGroup.Done() @@ -143,6 +145,15 @@ func Probe( // We must have reused the connection if we are a self probe! if (probeType == SelfUp || probeType == SelfDown) && !probeTracer.stats.ConnectionReused { + if !utilities.IsInterfaceNil(lgc) { + fmt.Fprintf(os.Stderr, + "(%s) (%s Probe %v) Probe should have reused a connection, but it didn't (connection status: %v)!\n", + debugging.Prefix, + probeType.Value(), + probeId, + lgc.Status(), + ) + } panic(!probeTracer.stats.ConnectionReused) } @@ -151,6 +151,7 @@ func CombinedProber( networkActivityCtx, &wg, foreignProbeClient, + nil, foreignProbeConfiguration.URL, foreignProbeConfiguration.Host, probe.Foreign, @@ -169,6 +170,7 @@ func CombinedProber( networkActivityCtx, &wg, selfDownProbeConnection.Client(), + selfDownProbeConnection, selfProbeConfiguration.URL, selfProbeConfiguration.Host, probe.SelfDown, @@ -191,6 +193,7 @@ func CombinedProber( proberCtx, &wg, selfUpProbeConnection.Client(), + nil, selfProbeConfiguration.URL, selfProbeConfiguration.Host, probe.SelfUp, |
