mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-12 10:04:29 +02:00
9d3416cc91
* Fix synchronization issues in global trace delegate implementation Running tests with `-race` and before the fix ``` ➜ opentelemetry-go git:(fixconcurrency) go test -race go.opentelemetry.io/otel/internal/global ================== WARNING: DATA RACE Write at 0x00c00010ffc8 by goroutine 28: go.opentelemetry.io/otel/internal/global.(*tracer).setDelegate.func1() /Users/lazy/github/opentelemetry-go/internal/global/trace.go:118 +0xf4 sync.(*Once).doSlow() /usr/local/opt/go/libexec/src/sync/once.go:68 +0x109 sync.(*Once).Do() /usr/local/opt/go/libexec/src/sync/once.go:59 +0x68 go.opentelemetry.io/otel/internal/global.(*tracer).setDelegate() /Users/lazy/github/opentelemetry-go/internal/global/trace.go:118 +0x76 go.opentelemetry.io/otel/internal/global.(*tracerProvider).setDelegate() /Users/lazy/github/opentelemetry-go/internal/global/trace.go:75 +0x16f go.opentelemetry.io/otel/internal/global.SetTracerProvider.func1() /Users/lazy/github/opentelemetry-go/internal/global/state.go:65 +0xd0 sync.(*Once).doSlow() /usr/local/opt/go/libexec/src/sync/once.go:68 +0x109 sync.(*Once).Do() /usr/local/opt/go/libexec/src/sync/once.go:59 +0x68 go.opentelemetry.io/otel/internal/global.SetTracerProvider() /Users/lazy/github/opentelemetry-go/internal/global/state.go:57 +0x79 go.opentelemetry.io/otel.SetTracerProvider() /Users/lazy/github/opentelemetry-go/trace.go:43 +0x388 go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:177 +0x373 testing.tRunner() /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202 Previous read at 0x00c00010ffc8 by goroutine 29: go.opentelemetry.io/otel/internal/global.(*tracer).Start() /Users/lazy/github/opentelemetry-go/internal/global/trace.go:124 +0x64 go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines.func1() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:165 +0xf1 Goroutine 28 (running) created at: testing.(*T).Run() /usr/local/opt/go/libexec/src/testing/testing.go:1239 +0x5d7 testing.runTests.func1() /usr/local/opt/go/libexec/src/testing/testing.go:1512 +0xa6 testing.tRunner() /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202 testing.runTests() /usr/local/opt/go/libexec/src/testing/testing.go:1510 +0x612 testing.(*M).Run() /usr/local/opt/go/libexec/src/testing/testing.go:1418 +0x3b3 go.opentelemetry.io/otel/internal/global_test.TestMain() /Users/lazy/github/opentelemetry-go/internal/global/internal_test.go:39 +0x4dc main.main() _testmain.go:85 +0x271 Goroutine 29 (running) created at: go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:160 +0x259 testing.tRunner() /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202 ================== ================== WARNING: DATA RACE Write at 0x00c00037a000 by goroutine 29: sync/atomic.StoreInt32() /usr/local/opt/go/libexec/src/runtime/race_amd64.s:242 +0xb go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines.func2.1() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:183 +0x6d go.opentelemetry.io/otel/internal/global_test.fnTracer.Start() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:81 +0x98 go.opentelemetry.io/otel/internal/global.(*tracer).Start() /Users/lazy/github/opentelemetry-go/internal/global/trace.go:125 +0xfd go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines.func1() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:165 +0xf1 Previous write at 0x00c00037a000 by goroutine 28: go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:176 +0x2c4 testing.tRunner() /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202 Goroutine 29 (running) created at: go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines() /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:160 +0x259 testing.tRunner() /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202 Goroutine 28 (running) created at: testing.(*T).Run() /usr/local/opt/go/libexec/src/testing/testing.go:1239 +0x5d7 testing.runTests.func1() /usr/local/opt/go/libexec/src/testing/testing.go:1512 +0xa6 testing.tRunner() /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202 testing.runTests() /usr/local/opt/go/libexec/src/testing/testing.go:1510 +0x612 testing.(*M).Run() /usr/local/opt/go/libexec/src/testing/testing.go:1418 +0x3b3 go.opentelemetry.io/otel/internal/global_test.TestMain() /Users/lazy/github/opentelemetry-go/internal/global/internal_test.go:39 +0x4dc main.main() _testmain.go:85 +0x271 ================== --- FAIL: TestTracerDelegates_MultiGoRoutines (0.20s) testing.go:1093: race detected during execution of test FAIL FAIL go.opentelemetry.io/otel/internal/global 0.920s FAIL ``` Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com> * Update internal/global/trace_test.go Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> * Update internal/global/trace_test.go Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> * Make tests not flaky Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> |
||
---|---|---|
.. | ||
benchmark_test.go | ||
internal_test.go | ||
meter_test.go | ||
meter.go | ||
propagator_test.go | ||
propagator.go | ||
registry_test.go | ||
state_test.go | ||
state.go | ||
trace_test.go | ||
trace.go |