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.28] Fix race condition panic in loadbalancer.nextServer #10323

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 25.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 36.10%. Comparing base (7de7adb) to head (b1ee1bb).
Report is 2 commits behind head on release-1.28.

Files Patch % Lines
pkg/agent/loadbalancer/servers.go 25.00% 9 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.28   #10323      +/-   ##
================================================
- Coverage         42.68%   36.10%   -6.58%     
================================================
  Files               163      160       -3     
  Lines             16632    14056    -2576     
================================================
- Hits               7099     5075    -2024     
+ Misses             8274     7989     -285     
+ Partials           1259      992     -267     
Flag Coverage Δ
e2etests 36.10% <25.00%> (-9.82%) ⬇️
unittests ?

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 5773a34 into k3s-io:release-1.28 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