From 00093883d53f5121ab5bc94a5b4de2ba3a38ef99 Mon Sep 17 00:00:00 2001 From: Christos Kalkanis Date: Tue, 21 Jan 2025 21:16:46 -0500 Subject: [PATCH] Synchronize with HandleTrace --- tracehandler/tracehandler.go | 4 +++- tracer/events.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tracehandler/tracehandler.go b/tracehandler/tracehandler.go index 0df319bd..f4021e57 100644 --- a/tracehandler/tracehandler.go +++ b/tracehandler/tracehandler.go @@ -189,7 +189,9 @@ func Start(ctx context.Context, rep reporter.TraceReporter, traceProcessor Trace for { select { case traceUpdate := <-traceInChan: - handler.HandleTrace(traceUpdate) + if traceUpdate != nil { + handler.HandleTrace(traceUpdate) + } case <-metricsTicker.C: handler.collectMetrics() case <-ctx.Done(): diff --git a/tracer/events.go b/tracer/events.go index eeed13cb..87489123 100644 --- a/tracer/events.go +++ b/tracer/events.go @@ -208,6 +208,9 @@ func (t *Tracer) startTraceEventMonitor(ctx context.Context, // the current iteration minKTime we'll call // SymbolizationComplete(t1) first and t0 next, with t0 < t1. if oldKTime > 0 { + // Ensure that all previously sent trace events have been processed + traceOutChan <- nil + if minKTime > 0 && minKTime <= oldKTime { // If minKTime is smaller than oldKTime, use it and reset it // to avoid a repeat during next iteration.