Skip to content

grpc-js-xds: Fix weighted cluster total calculation - #3070

Open
gunsch wants to merge 1 commit into
grpc:masterfrom
gunsch:codex/fix-xds-weighted-cluster-total
Open

grpc-js-xds: Fix weighted cluster total calculation#3070
gunsch wants to merge 1 commit into
grpc:masterfrom
gunsch:codex/fix-xds-weighted-cluster-total

Conversation

@gunsch

@gunsch gunsch commented Jul 28, 2026

Copy link
Copy Markdown

Fixes #3069.

The xDS resolver previously defaulted to a total weight of 100 if the total_weight field is empty (which is deprecated).

Instead, sum the cluster weights to get the total before using it in calculations.

Without this, resolution of a cluster with total weights of "1" would fail with:

TypeError: Cannot read properties of undefined (reading 'ref')
    at Object.invoke (.../node_modules/@grpc/grpc-js-xds/build/src/resolver-xds.js:343:36)

Testing:

  • added regression test

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 28, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: gunsch / name: Andrew Gunsch (96d2773)

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.

grpc-js-xds: WeightedCluster with omitted total_weight can select no cluster and crash in resolver

1 participant