Unleash / unleash-client-go

Unleash client SDK for Go
https://docs.getunleash.io
Apache License 2.0
138 stars 55 forks source link

infinitely blocked in metrics.count with gitlab #139

Closed c0olix closed 1 year ago

c0olix commented 1 year ago

Describe the bug

I am using Gitlab as unleash API, and I came across an error, where a request for an API-call against my microservice was timed out, since it never leaves the isEnabled func. After debugging I found out, that the metrics count in the defer is blocking infinitely. https://github.com/Unleash/unleash-client-go/blob/v3/client.go#L243 Further it was really hard to figure this out as it is in the defer. I know, that I can disable the metrics, and that`s my fix for it, but imho this should not block. It should return an error instead or panic, but it was really hard to figure this out.

Steps to reproduce the bug

No response

Expected behavior

No blocking

Logs, error output, etc.

No response

Screenshots

No response

Additional context

No response

Unleash version

3.8.0

Subscription type

None

Hosting type

None

SDK information (language and version)

Go

nunogois commented 1 year ago

Hi @c0olix, thanks for raising this issue. I'll reach out to the rest of the team and then get back to you.

daveleek commented 1 year ago

Hello @c0olix. We apologize, this appears to have slipped our attention. Has this issue been resolved, or is this still an issue you're experiencing?

daveleek commented 1 year ago

Hello again @c0olix. We have reproduced this issue and are working on a fix. The issue is due to messaging blocking when no listeners have been configured. So in the meantime until we can get a fix out a workaround is to include the unleash.WithListener(&unleash.DebugListener{}), in the unleash initialization