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
internal/balancergroup: eliminate race in exitIdle #5012
Conversation
I couldn't come up with a unit test for this. Please let me know if you have any ideas. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make two goroutines with loops, one calls UpdateSubConnState
, the other calls ExitIdle
?
Without incoming mu, the two goroutines should race.
sc.Connect() | ||
} | ||
} | ||
sbc.group.connect(sbc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the balancer group calls into the wrapper calls back into the group?
Would it be better to put all this logic in the group's ExitIdle function, then? Or return a bool and have ExitIdle do the connect
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
incomingMu
needs to be taken before accessingscToSubBalancer
map as part ofexitIdle
RELEASE NOTES: n/a