Commit 622a41d
authored
xds/clusterimpl: fix uint32 overflow computing EDS drop ratio (grpc#9257)
handleClusterConfigLocked turns each EDS drop_overload into a
per-million rate with `Numerator * million / Denominator` in uint32. The
numerator comes from the control plane and reaches a million for a 100%
drop, so with the million denominator the product overflows a uint32
once the numerator hits 4295 (a 0.43% drop), and the rate then collapses
toward zero: a 50% drop computes to 0.18% and a 100% drop to 0.36%. A
fraction above 100% instead lands `RequestsPerMillion` above a million,
which underflows `million - RequestsPerMillion` in newDropper.
Move the computation into `dropRequestsPerMillion`, which multiplies in
uint64 and caps the ratio at a million. Keeping the clamp next to the
arithmetic that builds DropConfig leaves the raw numerator and
denominator on the parsed resource and applies drops at the configured
rate.
RELEASE NOTES:
* xds: fix xDS EDS drop policies being applied at a much lower rate than
configured due to an integer overflow1 parent 216640c commit 622a41d
2 files changed
Lines changed: 41 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
154 | 167 | | |
155 | 168 | | |
156 | 169 | | |
| |||
172 | 185 | | |
173 | 186 | | |
174 | 187 | | |
175 | | - | |
| 188 | + | |
176 | 189 | | |
177 | 190 | | |
178 | 191 | | |
| |||
0 commit comments