Skip to content

Commit 19877b1

Browse files
dany74qpellareddmathieu
authored
Fix timer channel drain to avoid hanging in Go 1.23 (#5869)
- Fix timer channel drain to avoid hanging in go1.23 w/ asynctimerchan=0 (#5868) --------- Co-authored-by: Robert Pająk <[email protected]> Co-authored-by: Damien Mathieu <[email protected]>
1 parent e500945 commit 19877b1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2727

2828
- The race condition for multiple `FixedSize` exemplar reservoirs identified in #5814 is resolved. (#5819)
2929
- Fix log records duplication in case of heterogeneous resource attributes by correctly mapping each log record to it's resource and scope. (#5803)
30+
- Fix timer channel drain to avoid hanging on Go 1.23. (#5868)
3031

3132
<!-- Released section -->
3233
<!-- Don't change this section unless doing release -->

sdk/trace/batch_span_processor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,11 @@ func (bsp *batchSpanProcessor) processQueue() {
316316
bsp.batchMutex.Unlock()
317317
if shouldExport {
318318
if !bsp.timer.Stop() {
319-
<-bsp.timer.C
319+
// Handle both GODEBUG=asynctimerchan=[0|1] properly.
320+
select {
321+
case <-bsp.timer.C:
322+
default:
323+
}
320324
}
321325
if err := bsp.exportSpans(ctx); err != nil {
322326
otel.Handle(err)

0 commit comments

Comments
 (0)