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

Thread Safe Connection Pool #909

Merged
merged 1 commit into from
Jun 30, 2020
Merged

Thread Safe Connection Pool #909

merged 1 commit into from
Jun 30, 2020

Conversation

refs
Copy link
Member

@refs refs commented Jun 30, 2020

What?

We encountered concurrent map writes runtime errors on the pool package. This solution should address this error and provide with a safe way to access these data structures. Since they are not exported and the sync.Map works with interface{}, a type assertion is needed, making it hard to refactor this code since generics are non-existant in go (at the moment of this writing), and reflection will definitely under perform on this package, which is sort of a bottleneck.

closes #908

ping @butonic @individual-it

@refs refs requested a review from labkode as a code owner June 30, 2020 09:41
@butonic
Copy link
Contributor

butonic commented Jun 30, 2020

while a lock might be faster this PR at least makes the implementation concurrency safe. The locks require more management and the whole pool is in the todo package anyway. Good enough for now.

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.

concurrent access to client pool maps is unsafe
2 participants