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

pool: fix race condition at GetNextConnection() #312

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

oleg-jukovec
Copy link
Collaborator

@oleg-jukovec oleg-jukovec commented Jun 27, 2023

The r.current value can be changed by concurrent threads because the change happens under read-lock. We could use the atomic counter for a current connection number to avoid the race condition.

I didn't forget about (remove if it is not applicable):

Related issues:

Closes #309

@oleg-jukovec oleg-jukovec changed the title bugfix: race condition at GetNextConnection() pool: race condition at GetNextConnection() Jun 28, 2023
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-309-round-robin-race branch from 1708f5b to eaf2321 Compare June 28, 2023 10:33
@oleg-jukovec oleg-jukovec changed the title pool: race condition at GetNextConnection() pool: fix race condition at GetNextConnection() Jun 28, 2023
The `r.current` value can be changed by concurrent threads because
the change happens under read-lock. We could use the atomic counter
for a current connection number to avoid the race condition.

Closes #309
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-309-round-robin-race branch from eaf2321 to 3e77a2f Compare June 28, 2023 16:34
@oleg-jukovec oleg-jukovec merged commit dbfaab5 into master Jun 28, 2023
@oleg-jukovec oleg-jukovec deleted the oleg-jukovec/gh-309-round-robin-race branch June 28, 2023 17:00
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.

Data race on GetNextConnection in round-robin
3 participants