Skip to content

proxy: carried patch — a paused hot-restart child UDP listener no longer reads the parent's socket (#1054) - #1069

Merged
bpalermo merged 2 commits into
mainfrom
proxy/1054-paused-udp-listener-no-read
Sep 29, 2026
Merged

bpalermo merged 2 commits into
mainfrom
proxy/1054-paused-udp-listener-no-read

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Carries proxy/bazel/patches/envoy-aether1054c-paused-udp-listener-no-read.patch on the 726d7ac pin, after aether1054b, for the drain-start resets left after #1064 and #1066 (#1054). This one is an upstream bug in the hot-restart UDP forwarding design and will be proposed upstream separately.

The mechanism

A child UDP listener built on a socket inherited from the hot-restart parent is paused: its read events are disabled until the parent is gone, the parent keeps serving the socket, and the packets that belong to the child arrive over the hot-restart forwarding channel. That is the single-reader rule that makes sharing a UDP socket safe.

The child breaks it. When the parent forwards a new connection's first packet, the child's QUIC listener buffers the handshake and calls activateRead() on its own listener so the buffered handshakes are processed on the next loop iteration (active_quic_listener.cc, onDataWorker and onReadReady). An injected activation is delivered regardless of which events are enabled (FileEventImpl::mergeInjectedEventsAndRunCb ORs injected events in unmasked). The UDP listener's read handler (UdpListenerImpl::handleReadCallback) then does two things: it runs the read-ready hook, which was the intent, and it reads packets from the socket, which is the parent's. Nothing in it checks paused(). Every parent-owned packet the child dequeues is an unknown connection to its QUIC dispatcher and gets a stateless reset. Each reset makes a source reconnect, the new handshake is forwarded, the read fires again, until every source has migrated to the child.

That is why the resets: needed new connections during the window under load (a forwarded handshake is the trigger), lived where the k6 load lands (w04's pods) and nowhere else, clustered in the ~1.5 s after drain start, got worse with immediate drain and with GOAWAY-on-idle (more reconnects inside the window), were untouched by #1064 (exit window) and #1066 (time-wait), never appeared on kind's sparse harness (its burst was timed after Terminate), and coexisted with fully inherited sockets on w04 (the inode check). Present since UDP forwarding was added upstream (envoyproxy/envoy#29585).

The change

UdpListenerImpl::handleReadCallback: while paused(), run cb_.onReadReady() and return, without reading the socket and without re-arming the read. The QUIC listener's buffered-handshake processing keeps working (that is the read-ready hook); only the socket read is withheld. Unpausing is unchanged. Child-side, so it takes effect on the first roll after deploy.

Test (red without, green with)

udp_listener_impl_test.cc HotRestartedUdpListenerImplTest.InjectedReadWhilePausedDoesNotReadTheSocket: a paused listener gets a read event injected on its file event; the read-ready callback runs, no read of the socket happens (supportsMmsg/recv never called) and the read is not re-armed; once the parent-drained callback fires the listener starts reading as before. Without the fix the handler reads the socket (the test fails on the first read call). Passes for IPv4 and IPv6, with the existing pause tests, the QUIC listener test, the QUIC HTTP integration tests and hotrestart_test. Listed in //bazel/patches:carried_patch_tests.

What the talos run should show

Zero source-side Received_stateless_reset on every graded roll, first roll included, under load with gradual drain and no idle-timeout override. The parent's server.hot_restart_udp_forwarding_* counters (aether1050) still move during the window, since forwarding is unchanged; what disappears is the child reading the socket in parallel.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WyMzptZ12rAgMW8cXtKqE4

bpalermo and others added 2 commits September 29, 2026 13:53
…ger reads the parent's socket (#1054)

Carries envoy-aether1054c-paused-udp-listener-no-read.patch on the 726d7ac
pin, after aether1054b. A child UDP listener built on an inherited socket
is paused until the parent is gone, but its read handler did not know:
when the QUIC listener injected a read activation to process handshakes
buffered from forwarded packets, the handler read the shared socket and
dequeued the parent's packets, which the child's dispatcher answered with
stateless resets (the drain-start resets left after #1064 and #1066). The
handler now runs the read-ready hook and returns without reading while
paused. Child-side, effective from the first roll. Test in
udp_listener_impl_test (red without the patch), in
//bazel/patches:carried_patch_tests. An upstream bug; proposed upstream
separately.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WyMzptZ12rAgMW8cXtKqE4
Signed-off-by: Bruno Palermo <[email protected]>
@bpalermo
bpalermo merged commit a1bcf05 into main Sep 29, 2026
25 checks passed
@bpalermo
bpalermo deleted the proxy/1054-paused-udp-listener-no-read branch September 29, 2026 17:12
bpalermo added a commit that referenced this pull request Sep 30, 2026
…ied patches, config tables, CLAUDE.md package map (#1081)

* docs: refresh after the QUIC/hot-restart work — rollback advice, carried patches, config tables, CLAUDE.md package map

- runbook: the 1.0.11 escape hatch rolls the proxy (a1bcf05 vs 71be75f) and
  drops the #1074 patch unless proxy.image + proxy.supervisor.image are
  pinned; #979 is merged (soak-verdict placeholder); #1069 named as the
  #1054 root cause; new #1074 SIGBUS entry (#1077, envoyproxy/envoy#47893,
  chart 1.0.13); stray "0 disables the prune" moved.
- configuration: proxy drainStrategy/skipParentStats/terminationGrace,
  agent eastWestQuicIdleTimeout + flag, controller identity-gate flags,
  identity-ready section, cni-install --otlp-pin-endpoint, edge/registrar
  rows (the shared edge Service has no `type`; overload is fixed_heap).
- CLAUDE.md/AGENTS.md: TPROXY capture, QUIC/xDS/supervisor/CNI packages,
  port map, carried patches; proxy-ready ships in the supervisor image.
- README, getting-started, e2e, proposals 037/038/040 status lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

* docs: record the 2026-09-30 re-soak verdict for the unconditional-QUIC build (#979)

Every QUIC gate passed and #1073/#1074 did not recur; the run failed only on
liveness (9 / 719,984) from a hot-restart/agent-restart overlap (#1085).
First-use 503 NC burst and TRIPLE 504 UT filed as #1086 and #1087.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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