You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This panic behavior shows the possibility that the SetMeterProvider would miss the delegation setting for instruments and registry. We also need to fix this. The simple solution could be to use mutex to lock the whole instrumentation creation. SetMeterProvider might miss the delegation for instruments and registries #5780
XSAM
changed the title
SetMeterProvider may cause panic while creating instruments
instruments creation may cause panic when setting meter provider
Aug 30, 2024
Description
This bug was found in CI after running
TestMeterConcurrentSafe
test and was introduced in #5754, where creating instruments while callingsetDelegate
method.This is because creating instruments can be locked in this line:
opentelemetry-go/internal/global/meter.go
Line 350 in e47618f
While
setDelegate
is cleaninginstruments
map:opentelemetry-go/internal/global/meter.go
Line 144 in e47618f
Then, the remaining code in the instrument creation method would trigger panic after the mutex is unlocked:
opentelemetry-go/internal/global/meter.go
Line 360 in e47618f
Steps To Reproduce
go test -timeout 30s -run ^TestMeterConcurrentSafe$ go.opentelemetry.io/otel/internal/global -count 1000
Expected behavior
No Panic
Proposal
SetMeterProvider
would miss the delegation setting for instruments and registry. We also need to fix this. The simple solution could be to use mutex to lock the whole instrumentation creation.SetMeterProvider
might miss the delegation for instruments and registries #5780The text was updated successfully, but these errors were encountered: