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

[release-1.29] Fix race condition panic in loadbalancer.nextServer #10322

Merged

Conversation

brandond
Copy link
Member

@brandond brandond commented Jun 7, 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

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
@brandond brandond requested a review from a team as a code owner June 7, 2024 07:05
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 43.52%. Comparing base (485eaf3) to head (8864182).
Report is 1 commits behind head on release-1.29.

Files Patch % Lines
pkg/agent/loadbalancer/servers.go 66.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.29   #10322      +/-   ##
================================================
- Coverage         50.07%   43.52%   -6.55%     
================================================
  Files               163      163              
  Lines             14204    14209       +5     
================================================
- Hits               7112     6185     -927     
- Misses             5753     6844    +1091     
+ Partials           1339     1180     -159     
Flag Coverage Δ
e2etests 36.42% <25.00%> (-10.22%) ⬇️
inttests 37.10% <0.00%> (+0.07%) ⬆️
unittests 16.41% <66.66%> (+0.03%) ⬆️

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.

@brandond brandond merged commit 3ef137a into k3s-io:release-1.29 Jun 7, 2024
28 checks passed
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.

2 participants