envoyproxy / envoyproxy/envoy

ext_proc: onDestroy() prematurely closes gRPC stream on downstream half-close when response_body_mode is enabled

Open
#47,458 0 comments 0 reactions 0 assignees View on GitHub
bug triage
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.