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

Potential race condition in client handling #4

Open
kula opened this issue Feb 4, 2019 · 0 comments
Open

Potential race condition in client handling #4

kula opened this issue Feb 4, 2019 · 0 comments

Comments

@kula
Copy link
Owner

kula commented Feb 4, 2019

b.clientMutex.RUnlock()
return b.client, nil

I suspect there's a race condition here:

  1. We don't defer the release because there's two places we may release it, depending on if there's a current client or not
  2. We have to release the RLock before we call newB2Client because it needs to get a Lock

Check the handling of this --- I removing line 37 and doing a defer b.clientMutex.RUnlock() right before 36 would work.

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

No branches or pull requests

1 participant