Skip to content

Conversation

eshitachandwani
Copy link
Member

@eshitachandwani eshitachandwani commented Jul 4, 2025

RELEASE NOTES:

  • xds/cdsbalancer: Fixes panic in cdsBalancer by correctly removing cds watchers for clusters no longer in the cluster tree.

In the code for onClusterUpdate after the cluster tree has been updated, we want to remove the watchers for clusters that are not currently in the tree. The existing code will always panic because of the error in condition. This change fixes the removal of unwanted watchers.

Copy link

codecov bot commented Jul 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.45%. Comparing base (aa57e6a) to head (f6da874).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8428      +/-   ##
==========================================
+ Coverage   82.38%   82.45%   +0.06%     
==========================================
  Files         414      414              
  Lines       40403    40402       -1     
==========================================
+ Hits        33287    33313      +26     
+ Misses       5756     5733      -23     
+ Partials     1360     1356       -4     
Files with missing lines Coverage Δ
xds/internal/balancer/cdsbalancer/cdsbalancer.go 84.84% <100.00%> (+0.42%) ⬆️

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arjan-bal arjan-bal self-assigned this Jul 4, 2025
Comment on lines 446 to 449
var onwatcherUpdated = func() {
// This function is a no-op, but can be overridden in tests to signal that
// the watchers map has been updated.
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can avoid adding a function specifically for tests and instead verify that the unsubscription happens by intercepting the requests in the xDS management server. When creating the xDS management server, you can provide an OnStreamRequest in e2e.ManagementServerOptions. Once the management server removes the cluster, you can wait for an update CDS discovery request from the xds client which should not have the removed cluster.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Changed the test.

Copy link
Contributor

@arjan-bal arjan-bal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for finding and fixing this! Assigning a second reviewer.

@arjan-bal arjan-bal requested a review from dfawley July 7, 2025 05:39
@arjan-bal arjan-bal assigned dfawley and unassigned arjan-bal Jul 7, 2025
@arjan-bal
Copy link
Contributor

Please add release notes.

@dfawley dfawley assigned eshitachandwani and unassigned dfawley Jul 7, 2025
@eshitachandwani eshitachandwani merged commit a21e374 into grpc:master Jul 8, 2025
16 checks passed
@eshitachandwani eshitachandwani deleted the cds branch August 22, 2025 09:51
dimpavloff pushed a commit to dimpavloff/grpc-go that referenced this pull request Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants