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 occurs when setting non-comparable named providers #285

Open
Arthur1 opened this issue Sep 24, 2024 · 0 comments
Open

[BUG] Panic occurs when setting non-comparable named providers #285

Arthur1 opened this issue Sep 24, 2024 · 0 comments
Labels
bug Something isn't working Needs Triage

Comments

@Arthur1
Copy link

Arthur1 commented Sep 24, 2024

Observed behavior

If we set non-comparable provider multiple times as a named provider, runtime error panic occurs.

Expected Behavior

We expect the set of providers to complete without panic.

Steps to reproduce

InMemoryProvider struct is uncomparable because it has a map as a field. If we set InMemoryProvider multiple times as a named provider, the problem will be reproduced.

package main

import (
	"github.com/open-feature/go-sdk/openfeature"
	"github.com/open-feature/go-sdk/openfeature/memprovider"
)

func main() {
	openfeature.SetNamedProviderAndWait("a", memprovider.NewInMemoryProvider(nil))
	openfeature.SetNamedProviderAndWait("b", memprovider.NewInMemoryProvider(nil))
}
$ go run ./main.go                                                                  ✘ 1
panic: runtime error: comparing uncomparable type memprovider.InMemoryProvider

goroutine 1 [running]:
github.com/open-feature/go-sdk/openfeature.(*eventExecutor).triggerEvent(0x1400011a000, {{0x1022b79cf, 0x10}, {0x1022b7465, 0xe}, {{0x1022bbc27, 0x22}, {0x0, 0x0, 0x0}, ...}}, ...)
	/Users/arthur-1/go/pkg/mod/github.com/open-feature/go-sdk@v1.13.0/openfeature/event_executor.go:347 +0x1ec
github.com/open-feature/go-sdk/openfeature.(*evaluationAPI).initNewAndShutdownOld(0x1400011a080, {0x10230dd50, 0x0}, {0x0, 0x0}, 0x70?)
	/Users/arthur-1/go/pkg/mod/github.com/open-feature/go-sdk@v1.13.0/openfeature/openfeature_api.go:236 +0x1dc
github.com/open-feature/go-sdk/openfeature.(*evaluationAPI).SetNamedProvider(0x1400011a080, {0x1022dd3a0, 0x1}, {0x10230dd50, 0x0}, 0x0)
	/Users/arthur-1/go/pkg/mod/github.com/open-feature/go-sdk@v1.13.0/openfeature/openfeature_api.go:76 +0x110
github.com/open-feature/go-sdk/openfeature.SetNamedProviderAndWait(...)
	/Users/arthur-1/go/pkg/mod/github.com/open-feature/go-sdk@v1.13.0/openfeature/openfeature.go:59
main.main()
	/Users/arthur-1/Repositories/private/openfeature-sdk-panic/main.go:10 +0x88
exit status 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs Triage
Projects
None yet
Development

No branches or pull requests

1 participant