SIGN IN SIGN UP

extproc: implement channel retention as part of A93 (#9285)

This PR implements the channel retention for ext proc filter. It has the
following changes:
1. Adds refcounting to route cluster to ensure interceptors remain open
if there are any inflight RPCs or the config selector is active instead
of closing the interceptors unconditionally on XDS Config update.
2. Adds refcounting for ext proc channel which is incremented when
interceptor is built and for every RPC and decremented when interceptor
closes and proc RPC finishes.
3. Call RecvMsg on the dataplane stream if not called whenever the
context is cancelled to handle cases where the dataplane stream is
created but the RPC fails without every invoking any function on the
dataplane stream
This is a problem for unary RPC because it does not spawn a goroutine
waiting for ctx cancellation to do the cleanup.
4. Error checking on `cc.UpdateState` in sendNewServiceConfig was
removed

Reason : Previously, if `cc.UpdateState(s)` returned an error (e.g.,
when a sub-balancer reported a removed cluster or NACK), xdsResolver
called `cs.stop()` on the new ConfigSelector and continued tracking the
old one. However, `ClientConn.UpdateState(s)` unconditionally installs
the new ConfigSelector (cs) before updating the LB policy—even if
`updateClientConnState` subsequently errors.
This caused `ClientConn` and `xdsResolver` to become desynchronized:
ClientConn actively routed RPCs using cs, while xdsResolver had already
stopped it. With routeCluster now refcounted, calling `cs.stop()`
decrements its refcount to 0, causing any RPC calling `SelectConfig` on
cs to hit a dead resource and fail with "Resource already closed or
dead".
Removing the error check ensures xdsResolver unconditionally adopts cs,
keeping both components in sync, preserving cs's refcount, and allowing
RPCs to cleanly reach error pickers configured by cluster_manager LB
policy.

#ext-proc-a93

RELEASE NOTES: None
E
eshitachandwani committed
a2cc858436d4d1ba0aef3b736b64e0c990f15383
Parent: 5380ae2
Committed by GitHub <noreply@github.com> on 8/11/2026, 1:26:19 PM