From 978fedc6246d7c8ebe1f48a630f3a958ceb26fd6 Mon Sep 17 00:00:00 2001 From: dany74q Date: Thu, 3 Oct 2024 08:10:42 +0300 Subject: [PATCH] - Fix timer channel drain to avoid hanging in go1.23 w/ asynctimerchan=0 --- CHANGELOG.md | 1 + sdk/trace/batch_span_processor.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb9991a59df..6739f72b778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The race condition for multiple `FixedSize` exemplar reservoirs identified in #5814 is resolved. (#5819) - Fix log records duplication in case of heterogeneous resource attributes by correctly mapping each log record to it's resource and scope. (#5803) +- Fix timer channel drain to avoid hanging on go 1.23 with asynctimerchan=0 (#5868) diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 1d399a75db2..bc301b5a1eb 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -316,7 +316,10 @@ func (bsp *batchSpanProcessor) processQueue() { bsp.batchMutex.Unlock() if shouldExport { if !bsp.timer.Stop() { - <-bsp.timer.C + select { + case <-bsp.timer.C: + default: + } } if err := bsp.exportSpans(ctx); err != nil { otel.Handle(err)