You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(proxy): reject cached sessions on draining CNs (#25913)
## What type of PR is this?
- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring
## Which issue(s) this PR fixes:
issue #25895
## What this PR does / why we need it:
Normal proxy routing obtains candidates from `MOCluster.GetCNService`,
which
excludes draining and removed CNs. Cached backend reuse bypassed that
candidate
selection and `router.CanReuseCachedCN` checked only the CN health
circuit
breaker.
A draining CN can remain breaker-healthy, so a fresh client login could
continue
to reuse a cached backend session on a CN that normal routing had
already made
ineligible. This could delay or defeat graceful draining and scale-in.
This change requires cached reuse to pass both existing gates:
- the health breaker must allow the CN; and
- the CN UUID must still be present in the current `GetCNService`
routable
cluster view.
The existing nil-entry behavior is preserved. Missing and draining CNs
are
rejected, while a healthy routable CN remains reusable. No cache
capacity,
authentication, FIFO, timeout, routing-label, or circuit-breaker state
semantics
change. Regression tests cover nil, healthy, breaker-unhealthy,
recovered,
draining, and removed states.
## Test
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=100 -timeout=5m -run
'^TestCanReuseCachedCNRequiresCurrentRouteEligibility$' ./pkg/proxy`
`.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=20 -timeout=5m
-run '^TestCanReuseCachedCNRequiresCurrentRouteEligibility$'
./pkg/proxy`
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=10m
./pkg/proxy`
`.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=15m
./pkg/proxy`
`go build -mod=readonly ./pkg/proxy`
`go vet -mod=readonly ./pkg/proxy`
`git diff --check`
---------
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
0 commit comments