Skip to content

quic: leave time-wait connections to the time-wait list while a hot restart parent drains - #48206

Merged
RyanTheOptimist merged 1 commit into
envoyproxy:mainfrom
bpalermo:quic-hot-restart-time-wait-before-forward
Oct 13, 2026
Merged

RyanTheOptimist merged 1 commit into
envoyproxy:mainfrom
bpalermo:quic-hot-restart-time-wait-before-forward

Conversation

@bpalermo

Copy link
Copy Markdown
Contributor

Commit Message: quic: leave time-wait connections to the time-wait list while a hot restart parent drains
Additional Description:

While a hot restart parent drains, its QUIC dispatcher stops accepting new connections and EnvoyQuicDispatcher::OnFailedToDispatchPacket reports every packet without a live session as not dispatched, so ActiveQuicListener forwards it to the new process (#29585). That hook runs before quiche looks at its time-wait list, so "no live session" includes the connections this dispatcher has just closed itself, which is most of them during a drain. A late packet for one of those (a retransmission, or data sent before the peer saw the close) is forwarded to the child, which never knew the connection and answers with a stateless reset. Without the forwarding the parent's time-wait list would have re-sent the stored CONNECTION_CLOSE, which tells the peer why the connection ended.

Fix: while not accepting, a packet whose destination connection ID is in the time-wait list is left to quiche (the hook returns false and the dispatcher goes on to the time-wait list as usual). Only packets for connections the dispatcher does not know at all are forwarded. The change is in the parent, so it applies from the first hot restart in which the draining process has it.

Runtime guard: envoy.reloadable_features.quic_hot_restart_time_wait_before_forward (default true).

Testing: EnvoyQuicDispatcherTest.ProcessPacketHandlesTimeWaitConnectionLocallyWhenNotAccepting creates a session, closes it with a CONNECTION_CLOSE so its ID is in the time-wait list, stops accepting, and checks that a later packet for that ID is handled by the dispatcher while a packet for an unknown ID is still reported for forwarding. ProcessPacketForwardsTimeWaitConnectionWhenGuardDisabled checks the previous behavior with the guard off. active_quic_listener_test, quic_http_integration_test and hotrestart_test pass.

Observed on a deployment running HTTP/3 under load across hot restarts, as stateless resets around each restart. It was deployed there together with #47868, which fixes the larger source of those resets (the paused child listener reading the shared socket); this change has not been measured in isolation from that one, so its own share rests on the mechanism above and the unit tests.

Risk Level: low (QUIC listeners of a draining hot restart parent only; runtime guarded)
Testing: unit tests (new), QUIC listener and integration tests, hot restart integration test
Docs Changes: N/A
Release Notes: bug_fixes
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.quic_hot_restart_time_wait_before_forward

…estart parent drains

A draining hot restart parent's dispatcher reports every packet without a
live session for forwarding to the new process, before quiche consults
its time-wait list. Packets for connections the parent has just closed
were therefore forwarded to the child, which never knew them and answered
with a stateless reset instead of the parent re-sending the stored
CONNECTION_CLOSE. Leave connection IDs in the time-wait list to quiche
and forward only unknown ones.

Guarded by envoy.reloadable_features.quic_hot_restart_time_wait_before_forward.

Signed-off-by: Bruno Palermo <[email protected]>
@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #48206 was opened by bpalermo.

see: more, trace.

@KBaichoo

Copy link
Copy Markdown
Contributor

/assign @RyanTheOptimist

@RyanTheOptimist RyanTheOptimist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh! Great find and nice fix!

@RyanTheOptimist
RyanTheOptimist merged commit 69ff216 into envoyproxy:main Oct 13, 2026
27 checks passed
@bpalermo
bpalermo deleted the quic-hot-restart-time-wait-before-forward branch October 13, 2026 21:21
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.

3 participants