ext_proc: onDestroy() prematurely closes gRPC stream on downstream half-close when response_body_mode is enabled
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 428
Description
**Description**
When an HTTP/1.1 client sends a request and half-closes its request direction (SHUT_WR), Envoy's ext_proc filter destroys the filter instance (onDestroy()), which unconditionally invokes closeStreamMaybeGraceful().
Even when response_body_mode (e.g., STREAMED or BUFFERED) is configured and response-side processing is still required, Envoy terminates the gRPC stream to the external processor immediately upon the downstream request completing. As a result, the external processor never receives response-side ProcessingRequest messages.
**Repro steps**
Configure ext_proc with response_body_mode: STREAMED.
Send an HTTP request via a client that half-closes (shutdown(SHUT_WR)) after sending headers/body, then waits for the response.
Observe that the external processor receives request_headers (with end_of_stream: true) and immediately gets a gRPC stream half-close (ok == false), preventing any response-side processing.
**Expected Behavior**
A downstream client half-close on the request path should not cause Envoy to terminate the ext_proc gRPC stream if response-side external processing (response_body_mode != SKIP) is active and the upstream response has not yet been processed. The stream lifecycle should align with the full HTTP exchange, not just the decoding direction.
Contributor guide
Research direction
Start by tracing the ext_proc filter's onDestroy() and closeStreamMaybeGraceful() behavior for downstream request half-closes, using the response_body_mode handling described in the issue. Reproduce the HTTP/1.1 SHUT_WR sequence with STREAMED response processing and verify that response-side ProcessingRequest messages still arrive before the gRPC stream closes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc
- Domain
- backend-api-design, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100