Skip to content

xds: Implement separate request and response draining behavior in ext_proc client interceptor - #13011

Open
kannanjgithub wants to merge 9 commits into
grpc:masterfrom
kannanjgithub:ext_proc_draining_on_client
Open

xds: Implement separate request and response draining behavior in ext_proc client interceptor#13011
kannanjgithub wants to merge 9 commits into
grpc:masterfrom
kannanjgithub:ext_proc_draining_on_client

Conversation

@kannanjgithub

Copy link
Copy Markdown
Contributor

Implement separate request and response draining behavior in ext_proc client interceptor as per the updates in the gRFC.

When activateCall is called during draining (initiated by response drain), it flushes requests buffered in DelayedClientCall directly to the rawCall, bypassing flow control checks.

To fix this:
1. Buffer request(n) calls in pendingRequests when the call is IDLE, instead of letting them go to DelayedClientCall.
2. Guard drainPendingRequests to check isResponseSidecarReady and abort if it is false (keeping requests buffered).
3. Trigger drainPendingRequests when response drain completes.

Also updated tests to verify early request buffering during response drain.

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
Extend givenResponseDrainActive_whenAppRequestsMessages_thenRequestsBuffered to complete the response draining handshake and verify that buffered requests are then successfully sent to the data plane.

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
Add givenRequestDrainActive_whenAppRequestsMessages_thenRequestsDrained to verify that early request(n) calls are buffered when IDLE, and successfully drained to the data plane server upon activation if only request draining is active (which should not block the response/read path).

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
1. Fix onReadyNotify in DataPlaneListener to only forward onReady if dataPlaneClientCall.isReady() is true.
2. Call onReadyNotify in handleRequestDrainComplete to notify the app when request draining completes and the path becomes ready again.
3. Update givenRequestDrainActive_whenAppRequestsMessages_thenRequestsDrained to verify that onReady is NOT called during request drain but IS called after the drain completes.

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
1. Remove requestDrainComplete check from sendMessage to prevent out-of-order message delivery when app calls sendMessage concurrently with drain completion. Now we only bypass queue when passThroughMode is true.
2. Update givenExtProcStreamCompleted_whenIsReadyCalled_thenDelegatesToSuper test to expect the correct number of downstream isReady calls, which increased by 1 because we now correctly query isReady inside onReadyNotify on stream completion.

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
Remove requestDrainComplete check from immediate halfClose path, and safely restore early halfClose optimization under lock: allow immediate halfClose during requestDraining/requestDrainComplete only if body mode is NONE or if the buffer queue is empty and we either completed the handshake or haven't sent any body messages yet.

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
Initialize closeNow to observabilityMode to ensure the call is closed immediately when closing in observability mode, preventing hangs and avoiding duplicate proceedWithClose calls.

Update givenObservabilityMode_whenDataPlaneClosed_thenSidecarCloseIsDeferred to assert that onClose is called exactly once, preventing double onClose notifications from passing silently.

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
Wrap long lines and fix empty/whitespace catch block in test to conform to style guidelines.

TAG=agy
CONV=2c1e4760-c239-4698-810a-162bf10fccc4
@kannanjgithub
kannanjgithub requested a review from sauravzg August 28, 2026 12:42
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.

1 participant