open-feature / go-sdk-contrib

Community maintained OpenFeature Providers and Hooks for Go
https://openfeature.dev
Apache License 2.0
46 stars 45 forks source link

Panic on new Go-Feature-Flag provider #578

Closed dangra closed 1 month ago

dangra commented 2 months ago

GoFeatureFlag provider panics after upgrading from v0.1.33 to v0.2.0.

I don't have a small snippet I can share yet but will try to attach one asap.

This is related to https://github.com/open-feature/go-sdk-contrib/pull/547

 panic: runtime error: invalid memory address or nil pointer dereference
 [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1bcf4d2]
 goroutine 82 [running]:
 github.com/open-feature/go-sdk-contrib/providers/go-feature-flag/pkg.(*Provider).startPolling.func1()
         /home/vagrant/go/pkg/mod/github.com/open-feature/go-sdk-contrib/providers/go-feature-flag@v0.2.0/pkg/provider.go:248 +0x112
 created by github.com/open-feature/go-sdk-contrib/providers/go-feature-flag/pkg.(*Provider).startPolling in goroutine 69
         /home/vagrant/go/pkg/mod/github.com/open-feature/go-sdk-contrib/providers/go-feature-flag@v0.2.0/pkg/provider.go:226 +0xd6
dangra commented 2 months ago

the only possible way it can fail on line 248 is when err is nil

image
dangra commented 2 months ago

Definitively a bug in https://github.com/open-feature/go-sdk-contrib/blob/providers/go-feature-flag/v0.2.0/providers/go-feature-flag/pkg/controller/goff_api.go#L107

err is nil in that case.