Repository navigation
fix(quic): a twin request to a vanished destination fails 503 in <=10 s instead of hanging to the 15 s route timeout, and is never replayed (#1087) - #1101
Merged
Conversation
… transport idle (#1087) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Oct 1, 2026
…worker stalls (#1087) A 4 s idle deadline sits inside the 5-7 s node-local Envoy worker stalls of #1093: a stalled destination cannot ACK the keepalive PINGs, and a stalled source wakes with an expired idle alarm that QuicIdleNetworkDetector fires without re-checking when nothing is queued (a request to a slow, silent application). 8 s equals the pool idle, so no extra handshakes; the dead-peer bound becomes ~10 s. Tighten once #1093 is fixed. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
… agent; 11.5 s bound (#1087) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1087
What was happening
The source-side
504 UTlines from the 2026-10-01 TRIPLE (5 lines onsvc-3@aether-test/default, each 14.89–15.00 s) have matching destination-reporter lines with the samex_request_id. Read-only VictoriaLogs query onaether_access_logs:So the requests were delivered over QUIC.
upstream_peer_uri_sanis populated on every source line, so the handshake was done. The destination agents had loggedpod terminating: endpoint marked draining ahead of shutdown3.4–3.8 s before each request: w05 at 05:41:20.14, w02 at 05:41:36.42. The pods' SPIRE entries were deleted at 05:41:27.1 and 05:41:44.1. In between, CNI DEL removed the pods' veths.The destination proxy answered, or reset, at 3–5 s, but it wrote the answer into a pod netns that had no route out any more. The inbound QUIC listener is bound in the pod netns (
NewInboundQUICListener,network_namespace_filepath). The source never received anything.On the source side, nothing ran a timer shorter than the 15 s route timeout:
quiche 0.0.0-260922-7f07dc4) runs blackhole/path-degrading detection only while retransmittable packets are in flight and stops it in quiescence (quic/core/quic_connection.cc:3784-3797,6356-6363). The 5-RTO detector (quic_connection.cc:6846-6864) is therefore never armed.quic_protocol_options.createPersistentQuicInfoForClusterconverts the cluster's (empty) options (source/common/quic/client_connection_factory_impl.cc:36-38), andconvertQuicConfigsets an idle timeout only when one is configured (source/common/quic/envoy_quic_utils.cc:413-425), so the client used QUICHE'skMaximumIdleTimeoutSecsof 600 s (quic_constants.h:161). The inbound listener'sQuicProtocolOptions{}defaults to 300 s (source/common/quic/active_quic_listener.cc:324-329). The negotiated value is the minimum of the two (quic/core/quic_config.cc:1329-1337): 300 s.kPingTimeoutSecs = 15(quic_constants.h:170;quic_ping_manager.cc:98). Envoy only overrides it whenconnection_keepaliveis set (source/common/quic/envoy_quic_client_session.cc:312-328).--east-west-quic-idle-timeout(8 s, fix(quic): immediate drain + 8 s h3 twin idle so no source h3 connection outlives a hot-restart parent (#1054); skipParentStats default off now that #1060 fixes the deadlock #1063) does not apply. It is the HTTP pool'scommon_http_protocol_options.idle_timeout, which only counts streamless time, so it never fires with a stream open.close_connections_on_host_health_failuredoes not close the connection either. Envoy closes pools only on active-HC failure or outlier ejection (source/common/upstream/cluster_manager_impl.cc:971-988). An EDS DRAINING update or removal only drains the pool, and in-flight streams keep waiting. The comment onNewServiceClustersaying "incl. the EDS drain mark" is inaccurate; see open risks.The route timeout wins:
504 UTat 15 s. This is not specific to a restarting source agent. The kind red below reproduces it with the source agent frozen, and the soak shows it with the source agent up but the update arriving after the pick.The h2 path has the same hole for an already-delivered request. The TCP request is ACKed, the response is lost, and no TCP keepalive or HTTP/2 PING is configured, so it also waits the full 15 s. There is no RST, because the netns is gone before anything can send one. I saw this once on kind when an agent swap left
client-aonon_no_match(h2): 4 × 504 at 15.00 s. That run was discarded, and the harness now asserts that every measured request rode the twin. h2 is not changed here; see open risks.The fix (twin clusters only)
config.Http3ProtocolOptionsis used only byproxy.QUICClusterFrom. It now setshttp3_protocol_options.quic_protocol_options:How it works:
QuicSpdySession::ShouldKeepConnectionAlive,quic/core/http/quic_spdy_session.cc:1016-1020), the source sends a PING after 1 s of silence. QUICHE arms that alarm with 1 s granularity (quic_ping_manager.cc:37).QuicIdleNetworkDetectorcloses the connection 8 s after the first ack-eliciting packet sent since the peer was last heard (quic/core/quic_idle_network_detector.cc:68-88). The unanswered PING also arms QUICHE's 5-RTO blackhole detector, which fires about 6.4 s after the PING; whichever comes first closes the connection.per_try_timeout/per_try_idle_timeout. Those would sit on the route the twin shares with its h2 base (the matcher plugin only swaps the cluster specifier), and they would cap slow-but-alive requests.No replay, GET or POST:
ConnectionTermination:QUIC_NETWORK_IDLE_TIMEOUTwith 1-RTT keys maps there (source/common/quic/envoy_quic_utils.cc:196-211,envoy_quic_client_stream.cc:470-480).connect-failure,refused-stream,reset-before-request,retriable-status-codes[503],outboundRetryPolicy) does not retry that.reset-before-requestrequires!upstream_request_started, which is set fromfirst_upstream_tx_byte_sent_(source/common/router/router.cc:1650-1653). Connect-failure only coversLocal/RemoteConnectionFailure/ConnectionTimeout. A 503 response is not a reset (source/common/router/retry_state_impl.cc:433-490).retriable_request_headerswould scope the whole policy.connect_timeout(max_time_before_crypto_handshake,client_connection_factory_impl.cc:39-44). That is a connect failure, so they are retried on another endpoint withprevious_hosts, as before.Why 8 s and not 4 s (review change, #1093). The first revision used 4 s. #1093 (PR #1100) shows talos-main has node-local Envoy worker stalls: requests delayed 1–3.3 s, episodes of 5–7 s, including outside rolls. An idle deadline cannot tell a dead peer from one that is simply not being scheduled.
event.c:2072,evsel->dispatch) before expired timers (event.c:2091,timeout_process), and Envoy sets no event priorities, so both sit in one FIFO active queue.EnvoyQuicClientConnection::onFileEventreads the socket first (envoy_quic_client_connection.cc:319-364). Envoy stamps each packet with the time it is read (source/common/network/utility.cc:599,:674), not when it arrived, soOnPacketReceivedpushes the deadline past now.EnvoyQuicAlarm::UpdateImpl→enableHRTimer→event_addthen removes the stale timer activation from the active list (event.c:2796-2810).QuicIdleNetworkDetector::OnAlarmcallsOnIdleNetworkDetectedwith no deadline re-check (quic_idle_network_detector.cc:28-30), and neither doQuicAlarm::Fire(quic_alarm.cc:82-93) orEnvoyQuicAlarm's callback (envoy_quic_alarm.cc:11). Such a request would be idled out spuriously.--east-west-quic-idle-timeout), so idle pairs pay no extra handshake. The constant's comment says to tighten it once proxy: a multi-second node-local stall at the parent's 'closing and draining listeners' during some hot-restart handoffs (1 liveness timeout in the 2026-10-01 soak, not #1085) #1093 is fixed. The unit test and the envoy_validate test both assert idle ≥ 8 s and bound ≤ 10 s.Cost: the idle timeout is negotiated as the minimum on both ends, so an idle twin connection also closes after 8 s at the transport level, which matches the pool idle. A flag value above 8 s no longer lengthens reuse. The client's deadline is always earlier than the server's, because the server last heard the client's ACK of its final packet, so the client never sends into a connection the server has already closed. Docs updated:
docs/configuration.md,docs/runbook.md(new #1087 section), flag help. No chart change.Evidence
//test/envoy_validate— new testTestQUICUpstreamsDetectADeadPeerruns over the fixture bytesenvoy --mode validateaccepts. It asserts:idle_network_timeout8 s andkeepalive.max_interval1 s (with the bound ≤ 10 s and idle ≥ 8 s, per proxy: a multi-second node-local stall at the parent's 'closing and draining listeners' during some hot-restart handoffs (1 liveness timeout in the 2026-10-01 soak, not #1085) #1093);Seen red on main (assertion, not compile):
Green on the branch. The existing
TestEnvoyValidatealso validates the fixture, which proves Envoy accepts the new options. A unit test,TestHttp3ProtocolOptionsDetectADeadPeer, pins the constants and the bound.kind red → green — new harness
e2e/eastwest-quic-deadpeer.sh(clusteraether-1087). It reuses theEWQ_WORKER=1bring-up ofe2e/eastwest-quic.sh, which gainsEWQ_IMAGE_TAGso concurrent builds cannot swap:latestimages.Setup:
quic-aat 2 replicas on the worker,client-aon the control plane.Each arm ran on a fresh cluster. Agents: main
75caf0fvs branche86ed62(8 s), checked via the image revision label. The 4 s revision3ec489bmeasured 5.0 s for leg A and a 6.01 s max for leg B. The twin's options were read from the source node's config dump:nullon red,{"connection_keepalive":{"max_interval":"1s"},"idle_network_timeout":"8s"}on green.The first red run with the original harness had leg B 504 × 1 at 15.00 s (the POST in flight at the cut) and 503s at 6.41 s; same shape. Leg B also shows why the continuous scenario alone gives ~6.4 s on main rather than 15 s: a request sent onto the dead connection arms the blackhole detector. The 15 s hang needs a delivered request with nothing sent after it, which is leg A and the soak.
Commands:
Checks run
bazel testfor//agent/internal/xds/{config,proxy,cache}:all,//agent/internal/cmd:alland//test/envoy_validate:all: all pass.--config=raceon//agent/internal/xds/config:alland//agent/internal/cmd:all: pass.make gazelle,make format, andbazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean.Open risks / follow-ups (not in this PR)
Http2ProtocolOptions.connection_keepalive {interval, timeout}onNewServiceCluster. It needs its own kind leg: an h2-only source via a weighted GAMMA split.NewServiceCluster's comment onCloseConnectionsOnHostHealthFailureclaims it fires on the EDS drain mark. Envoy only calls it from active HC and outlier ejection (cluster_manager_impl.cc:971-988), so DRAINING drains pools and leaves in-flight streams alone.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr