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

Fix race condition panic in loadbalancer.nextServer #10318

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

brandond
Copy link
Member

@brandond brandond commented Jun 6, 2024

Proposed Changes

Fix race condition panic in loadbalancer.nextServer

Multiple goroutines may increment the nextServerIndex field at the same time, after its value has been clamped to the size of the list by another goroutine. This leads to an attempt to reference an item past the end of the list.

Types of Changes

bugfix

Verification

See linked issue.

This may be hard to replicate on k3s, as it requires a large number of goroutines dialing connections using a loadbalancer with multiple failed servers in the list.

Testing

Linked Issues

User-Facing Change


Further Comments

@brandond brandond requested a review from a team as a code owner June 6, 2024 23:55
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.

Project coverage is 41.55%. Comparing base (d9b8ba8) to head (b7bc373).
Report is 1 commits behind head on master.

Files Patch % Lines
pkg/agent/loadbalancer/servers.go 66.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10318      +/-   ##
==========================================
- Coverage   47.72%   41.55%   -6.18%     
==========================================
  Files         177      177              
  Lines       14802    14806       +4     
==========================================
- Hits         7064     6152     -912     
- Misses       6396     7479    +1083     
+ Partials     1342     1175     -167     
Flag Coverage Δ
e2etests 36.26% <25.00%> (-10.00%) ⬇️
inttests 36.94% <0.00%> (-0.01%) ⬇️
unittests 11.35% <66.66%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

3 participants