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

Race between connArray.Get() and connArray.Close() #464

Closed
youjiali1995 opened this issue Apr 6, 2022 · 1 comment
Closed

Race between connArray.Get() and connArray.Close() #464

youjiali1995 opened this issue Apr 6, 2022 · 1 comment
Assignees

Comments

@youjiali1995
Copy link
Contributor

connArray.Get() reads v[] without lock

func (a *connArray) Get() *grpc.ClientConn {
next := atomic.AddUint32(&a.index, 1) % uint32(len(a.v))
return a.v[next]
}
and connArray.Close() may modify it in the recycleIdleConnArray goroutine
a.v[i] = nil

@youjiali1995 youjiali1995 self-assigned this Apr 6, 2022
@youjiali1995
Copy link
Contributor Author

Fixed by #465

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