1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-05 00:28:58 +02:00

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
(https://github.com/open-telemetry/opentelemetry-go/issues/5868)

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
This commit is contained in:
Danny Shemesh
2024-10-04 10:48:57 +03:00
committed by GitHub
parent e500945247
commit 19877b1654
2 changed files with 6 additions and 1 deletions

View File

@ -316,7 +316,11 @@ func (bsp *batchSpanProcessor) processQueue() {
bsp.batchMutex.Unlock()
if shouldExport {
if !bsp.timer.Stop() {
<-bsp.timer.C
// Handle both GODEBUG=asynctimerchan=[0|1] properly.
select {
case <-bsp.timer.C:
default:
}
}
if err := bsp.exportSpans(ctx); err != nil {
otel.Handle(err)