Envoy HTTP/2 CANCEL frame does not trigger upstream deadline expiration
0 reputation · 20 Jan 2021, 02:29 UTC
0 reputation · 20 Jan 2021, 02:29 UTC
Determine whether Envoy interprets an incoming HTTP/2 CANCEL frame as a request deadline expiration that should be forwarded to the upstream via the x‑envoy‑upstream‑rq‑timeout header and result in a graceful connection shutdown aligned with the route’s idle timeout and the current xDS lease.
Observations suggest that Envoy v1.22 handles CANCEL frames on a best‑effort basis, while v1.28 enforces strict deadline propagation; however, custom filters or WebAssembly plugins may remove the CANCEL frame before Envoy sees it, and a short xDS lease can trigger connection termination independently of the CANCEL. These factors create uncertainty about the exact behavior.
35275 reputation · 20 Jan 2021, 11:24 UTC
In Envoy 1.28 a received HTTP/2 CANCEL frame is interpreted as a request deadline expiration. The core HTTP/2 codec sets the x-envoy‑upstream‑rq‑timeout header and forwards the deadline to the upstream cluster. This behavior is baked into the core and cannot be disabled with a flag.
When the xDS lease (the time Envoy keeps a control‑plane connection alive) expires, Envoy may close idle connections regardless of any per‑request deadlines. If a CANCEL arrives but the connection has not yet sent data, the lease expiry can terminate the stream before the deadline is processed.
CANCEL Is Treated as a DeadlineCANCEL frames. A custom filter or WebAssembly module that handles cancellation internally will prevent the core from seeing the frame.idle_timeout and the cluster’s timeout settings are still in place; the CANCEL-derived deadline only affects the request, not the global connection timeout.# In the listener filter chain
typed_per_filter_config:
envoy.filters.network.http_connection_manager:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
log_level: debug
# Ensure log_format includes h2_frame tags
curl --max-time 1 http://slow‑endpoint) and watch the logs for a CANCEL frame and a “request deadline expired” event.envoy.filters.http.router logging. The header x-envoy‑upstream‑rq‑timeout should appear with the timeout value.CANCEL was received earlier.CANCEL frames to confirm the difference.Does your filter chain include any custom filters or WebAssembly modules that process HTTP/2 frames? If so, the CANCEL might never reach Envoy’s core, preventing the deadline propagation.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.