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

Bug: panic on SetMeterProvider #5852

Closed
sarathsp06 opened this issue Sep 28, 2024 · 1 comment · Fixed by #5828
Closed

Bug: panic on SetMeterProvider #5852

sarathsp06 opened this issue Sep 28, 2024 · 1 comment · Fixed by #5828
Labels
bug Something isn't working duplicate This issue or pull request already exists
Milestone

Comments

@sarathsp06
Copy link

Description

Panic on setting SetMeterProvider

Starting: /home/sarath/gopath/bin/dlv dap --listen=127.0.0.1:37125 --log-dest=3 from /home/sarath/projects/messageplusio/be/cmd/rest
DAP server listening at: 127.0.0.1:37125
Type 'dlv help' for list of commands.
2024/09/28 08:22:32 goose: no migrations to run. current version: 20240906210523
2024/09/28 08:22:32 goose: no migrations to run. current version: 20230711140249
2024/09/28 08:22:32 invalid observable: from different implementation
2024/09/28 08:24:41 failed to upload metrics: context deadline exceeded
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb6295c]

goroutine 1 [running]:
go.opentelemetry.io/otel/internal/global.(*registration).setDelegate(0xc000450900, {0x1d97308, 0xc000494160})
	/home/sarath/gopath/pkg/mod/go.opentelemetry.io/otel@v1.30.0/internal/global/meter.go:492 +0x25c
go.opentelemetry.io/otel/internal/global.(*meter).setDelegate(0xc00019e090, {0x1d7c830, 0xc00011c960})
	/home/sarath/gopath/pkg/mod/go.opentelemetry.io/otel@v1.30.0/internal/global/meter.go:138 +0x2bc
go.opentelemetry.io/otel/internal/global.(*meterProvider).setDelegate(0xc0003ff080, {0x1d7c830, 0xc00011c960})
	/home/sarath/gopath/pkg/mod/go.opentelemetry.io/otel@v1.30.0/internal/global/meter.go:47 +0x1d4
go.opentelemetry.io/otel/internal/global.SetMeterProvider.func1()
	/home/sarath/gopath/pkg/mod/go.opentelemetry.io/otel@v1.30.0/internal/global/state.go:171 +0xad
sync.(*Once).doSlow(0x26a0d80, 0xc00059f1a0)
	/home/sarath/go/src/sync/once.go:76 +0x168
sync.(*Once).Do(0x26a0d80, 0xc00059f1a0)
	/home/sarath/go/src/sync/once.go:67 +0x3e
go.opentelemetry.io/otel/internal/global.SetMeterProvider({0x1d7c830, 0xc00011c960})
	/home/sarath/gopath/pkg/mod/go.opentelemetry.io/otel@v1.30.0/internal/global/state.go:169 +0x22d
go.opentelemetry.io/otel.SetMeterProvider({0x1d7c830, 0xc00011c960})
	/home/sarath/gopath/pkg/mod/go.opentelemetry.io/otel@v1.30.0/metric.go:41 +0x1d
github.com/messageplusio/be/pkg/telemetry.InitMeterProvider({0x1d85558, 0x26a06c0})
	/home/sarath/projects/messageplusio/be/pkg/telemetry/telemetry.go:63 +0x2e5
main.main()
	/home/sarath/projects/messageplusio/be/cmd/rest/main.go:86 +0xb59
Process 249736 has exited with status 2
Detaching

Explanation

If RegisterCallback fails with an error then reg would be nil and unusable. Trying derefer reg for reg.Unregister would panic

Fix : #5851

Environment

Applicable on any env

  • OS: Fedora
  • Architecture: x86
  • Go Version: 1.23.1
  • opentelemetry-go version: v1.30.0

Expected behavior

No panic

@MrAlias
Copy link
Contributor

MrAlias commented Sep 28, 2024

This looks like a duplicate of #5827

@MrAlias MrAlias added the duplicate This issue or pull request already exists label Sep 28, 2024
@XSAM XSAM added this to the v1.31.0 milestone Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants