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

fix: Duplicate redis client leak #223

Merged
merged 2 commits into from Mar 28, 2023

Conversation

robinbraemer
Copy link
Contributor

@robinbraemer robinbraemer commented Mar 28, 2023

As soon as we RUnlock we must assume that clients was updated by another goroutine.
Failing to do so could overwrite the existing redis client in c.client[addr] and leak all its resources like the connection pool.
We should still use the RWMutex as the fast-path of func (c *Client) Get(addr string) *redis.Client

@sonarcloud
Copy link

sonarcloud bot commented Mar 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@buraksezer buraksezer changed the base branch from master to release/v0.5.0 March 28, 2023 22:14
@buraksezer buraksezer merged commit 6d22536 into buraksezer:release/v0.5.0 Mar 28, 2023
6 checks passed
@buraksezer
Copy link
Owner

Thank you for your contribution, @robinbraemer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants