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

panic: comparing uncomparable type propagation.compositeTextMapPropagator #2772

Closed
corani opened this issue Apr 7, 2022 · 3 comments · Fixed by #2773
Closed

panic: comparing uncomparable type propagation.compositeTextMapPropagator #2772

corani opened this issue Apr 7, 2022 · 3 comments · Fixed by #2773
Assignees
Labels
bug Something isn't working
Projects

Comments

@corani
Copy link

corani commented Apr 7, 2022

Description

Calling otel.SetTextMapPropagator with a propagation.NewCompositeTextMapPropagator panics.

Environment

  • OS: Linux
  • Architecture: x86
  • Go Version: 1.17.8
  • opentelemetry-go version: 1.6.2

Steps To Reproduce

package main

import (
    "go.opentelemetry.io/otel"
    "go.opentelemetry.io/otel/propagation"
)

func main() {
    prop := propagation.NewCompositeTextMapPropagator(
        // anything
    )

    otel.SetTextMapPropagator(prop) // this works
    otel.SetTextMapPropagator(prop) // this panics
}

results in:

panic: runtime error: comparing uncomparable type propagation.compositeTextMapPropagator

Expected behavior

This worked in 1.6.1.

Issue was introduced in 1.6.2, in otel/internal/global/state.go:79.

@corani corani added the bug Something isn't working label Apr 7, 2022
@corani
Copy link
Author

corani commented Apr 7, 2022

Appears to have been introduced in #2749

@dmathieu
Copy link
Member

dmathieu commented Apr 7, 2022

I guess this happens because we moved the comparison outside of delegateTextMapPropagatorOnce.Do.
So re-setting the propagator used not to run the comparison.

@MrAlias MrAlias added this to Needs triage in Bugs via automation Apr 7, 2022
@MrAlias MrAlias self-assigned this Apr 7, 2022
@MrAlias MrAlias moved this from Needs triage to High priority in Bugs Apr 7, 2022
MrAlias added a commit to MrAlias/opentelemetry-go that referenced this issue Apr 7, 2022
The global MeterProvider, TracerProvider, and TextMapPropagator should
not panic when they are set to a non-comparable implementation of each.
@MrAlias MrAlias added this to the Release v1.6.3 milestone Apr 7, 2022
Bugs automation moved this from High priority to Closed Apr 7, 2022
MrAlias added a commit that referenced this issue Apr 7, 2022
* Fix #2772: allow non-comparable global types

The global MeterProvider, TracerProvider, and TextMapPropagator should
not panic when they are set to a non-comparable implementation of each.

* Add changes to changelog

* No lint unused field for testing
@MrAlias MrAlias mentioned this issue Apr 7, 2022
@corani
Copy link
Author

corani commented Apr 8, 2022

Confirmed fixed, thanks for the quick action!

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
Archived in project
Bugs
  
Closed
Development

Successfully merging a pull request may close this issue.

3 participants