Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instruments creation may cause panic when setting meter provider #5757

Closed
XSAM opened this issue Aug 30, 2024 · 1 comment · Fixed by #5780
Closed

instruments creation may cause panic when setting meter provider #5757

XSAM opened this issue Aug 30, 2024 · 1 comment · Fixed by #5780
Assignees
Labels
bug Something isn't working
Milestone

Comments

@XSAM
Copy link
Member

XSAM commented Aug 30, 2024

Description

This bug was found in CI after running TestMeterConcurrentSafe test and was introduced in #5754, where creating instruments while calling setDelegate method.

This is because creating instruments can be locked in this line:

While setDelegate is cleaning instruments map:

m.instruments = nil

Then, the remaining code in the instrument creation method would trigger panic after the mutex is unlocked:

m.instruments[id] = i

Steps To Reproduce

  1. Run
go test -timeout 30s -run ^TestMeterConcurrentSafe$ go.opentelemetry.io/otel/internal/global -count 1000

Expected behavior

No Panic

Proposal

@XSAM XSAM added the bug Something isn't working label Aug 30, 2024
@XSAM XSAM self-assigned this Aug 30, 2024
@XSAM XSAM changed the title SetMeterProvider may cause panic while creating instruments instruments creation may cause panic when setting meter provider Aug 30, 2024
@XSAM
Copy link
Member Author

XSAM commented Aug 30, 2024

This blocks the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant