Skip to content

QUIC eBPF hot restart part 0 - #45504

Merged
RyanTheOptimist merged 63 commits into
envoyproxy:mainfrom
filipcacky:quic_ebpf_hotrestart_0
Oct 20, 2026
Merged

RyanTheOptimist merged 63 commits into
envoyproxy:mainfrom
filipcacky:quic_ebpf_hotrestart_0

Conversation

@filipcacky

@filipcacky filipcacky commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Commit Message: quic: Defer CID generator factory and socket option init to initializeWorkerRouting (QUIC eBPF hot restart part 0)

Additional Description:

Adds ActiveUdpListenerFactory::initializeWorkerRouting, called once when a listener is added or updated, after the listen sockets are created and before the listener starts warming.

EnvoyQuicConnectionIdGeneratorFactory creation is deferred to initializeWorkerRouting. Creating it in the ActiveQuicListenerFactory constructor would be too early for upcoming eBPF hot restart support, which will receive the eBPF program fd via the hot restart RPC and create a factory per reuseport group from the listen sockets.

The listener init target is now registered with the server init manager after initializeWorkerRouting instead of at the end of the ListenerImpl constructor, so that connection ID generator factories can register init targets with the listener's init manager.

Factory-specific UDP socket options were previously gathered via ActiveUdpListenerFactory::socketOptions(). They are now created and applied in initializeWorkerRouting.

createCompatibleLinuxBpfSocketOption now returns absl::StatusOr<> instead of a bare Network::Socket::OptionConstSharedPtr. Initialization errors are reported through the status rather than a nullptr return. Unsupported platforms return absl::UnimplementedError, which callers treat as a soft failure and fall back to userspace routing, matching the previous nullptr handling. The function must return a valid socket option on success.

Risk Level: High
Testing: Added test suite for ActiveQuicListenerFactoryInitializeWorkerRoutingTest and a testcase for ListenerManagerImplQuicOnlyTest. The listener_manager_impl_test and listener_manager_impl_quic_only_test suites are parameterized on the runtime guard and cover both initialization orders.
Docs Changes: N/A
Release Notes: Added a minor_behavior_changes entry for the deferred initialization and its runtime guard.
Runtime guard: envoy.restart_features.defer_worker_routing_init defers QUIC connection ID generator factory creation and its packet-routing socket option from listener construction to initializeWorkerRouting, and listener init target registration to just after it.

@filipcacky
filipcacky marked this pull request as draft June 8, 2026 14:48
@repokitteh-read-only

Copy link
Copy Markdown

Hi @filipcacky, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #45504 was opened by filipcacky.

see: more, trace.

@filipcacky
filipcacky had a problem deploying to external-contributors June 8, 2026 14:48 — with GitHub Actions Error
@filipcacky
filipcacky had a problem deploying to external-contributors June 8, 2026 16:25 — with GitHub Actions Error
@filipcacky
filipcacky force-pushed the quic_ebpf_hotrestart_0 branch from 8aaf7f7 to 005b8c8 Compare June 23, 2026 21:04
@filipcacky
filipcacky force-pushed the quic_ebpf_hotrestart_0 branch from 005b8c8 to 5a082d4 Compare June 23, 2026 21:17
@filipcacky

Copy link
Copy Markdown
Contributor Author

First set of patches for #34731. Hot-restart, listener reload and ebpf are WIP. I would appreciate a review for this, since other changes build on top.

/assign @ravenblackx @danzh2010

@repokitteh-read-only

Copy link
Copy Markdown

filipcacky is not allowed to assign users.

🐱

Caused by: a #45504 (comment) was created by @filipcacky.

see: more, trace.

@filipcacky
filipcacky marked this pull request as ready for review June 23, 2026 21:30
@ravenblackx ravenblackx self-assigned this Jun 24, 2026
}
}

absl::Status ActiveQuicListenerFactory::doFinalPreWorkerInit() {

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.

Why moving the logic to doFinalPreWorkerInit() would require splitting context out of cid generator factory interface?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

quic_lb needs to run its init in the factory ctor, since by the time doFinalPreWorkerInit is called, init manager is already in Initialized state and calling secretsProvider results in

ASSERT(false, fmt::format("attempted to add {} to initialized {}", target.name(), name_));

eBPF needs context per reuseport group and access to duplicated sockets to make it. Socket sharing hot-restart RPC runs in ListenSocketFactoryImpl after ActiveQuicListenerFactory.

ActiveQuicListenerFactory is also shared between address and additional_addresses, these need separate contexts for eBPF, for deterministic and quic_lb it doesn't matter.

… after `buildListenSocketOptions`"

This reverts commit 5a082d4.

Signed-off-by: Filip Cacky <[email protected]>
…r `buildListenSocketOptions`"

This reverts commit ae9cf11.

Signed-off-by: Filip Cacky <[email protected]>
@filipcacky

Copy link
Copy Markdown
Contributor Author

/retest

@filipcacky

Copy link
Copy Markdown
Contributor Author

/retest

Comment on lines 720 to 724

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.

We still need this early return here right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, same usecase as my in_place_update in initializeWorkerRoutingForUdpListener.

udp_listener_config_->writer_factory_ = factory_factory->createUdpPacketWriterFactory(
config.udp_listener_config().udp_packet_packet_writer_config(), *listener_factory_context_);
}
absl::StatusOr<Network::ActiveUdpListenerFactoryPtr> udp_listener_factory =

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.

Re https://github.com/envoyproxy/envoy/pull/45504/changes/BASE..00e0e562b49647aa24f6ac61ad916e0676b83c4a#r4008203051, it looks like the change would cause a subtle behavioral diff. Why not inlining createUdpListenerFactory() so we can be sure this is purely refactoring?

@filipcacky

Copy link
Copy Markdown
Contributor Author

/retest

@nezdolik

nezdolik commented Oct 9, 2026

Copy link
Copy Markdown
Member

looks like sync with upstream main is needed

/wait

danzh2010
danzh2010 previously approved these changes Oct 13, 2026
enable_session_idle_list);
}

absl::Status ActiveQuicListenerFactory::initializeCidGeneratorAndWorkerRouting() {

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.

nits: move this above initializeWorkerRouting() for better diff

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed, ty!

@filipcacky
filipcacky force-pushed the quic_ebpf_hotrestart_0 branch from 6e9740d to 6d20124 Compare October 14, 2026 21:38
@filipcacky

Copy link
Copy Markdown
Contributor Author

/retest

@filipcacky

Copy link
Copy Markdown
Contributor Author

Hi @RyanTheOptimist, would you like to do another pass?

@RyanTheOptimist
RyanTheOptimist merged commit 2f6040e into envoyproxy:main Oct 20, 2026
27 checks passed
bpalermo-agent-bot Bot pushed a commit to bpalermo/aether that referenced this pull request Nov 1, 2026
… a QUIC listener

#1733's proxy workflow (run 41308410926, both arches) failed
//agent/test/envoy_validate:envoy_validate_test: `envoy --mode validate` of
node_bootstrap.json, edge_bootstrap.json and the ADS reconnect test's
bootstrap died with SIGSEGV in
Quic::ActiveQuicListenerFactory::initializeWorkerRouting().

envoyproxy/envoy#45504, in the 011e396 snapshot, moved the QUIC listener's
socket options there (behind envoy.restart_features.defer_worker_routing_init,
default true) and applies them to every worker's listen socket. Validation
mode creates no sockets (ValidationListenerComponentFactory::createListenSocket
returns nullptr), so *socket dereferences null. Upstream main still has it.
The proxy-supervisor's check before every hot restart on a changed bootstrap
is `envoy --mode validate`, so this would have blocked every bootstrap change
in production.

The patch skips a null socket, which only validation mode produces, as
validation did before #45504. Regression test: envoy_validate_test in the
proxy workflow, red on 8ce601a. Not reported upstream (on hold).

The "FilterStateMatcherValidationError.Key: value length must be at least 1
characters" line in the same log is TestAgentCaptureListenerAndTableValidate's
expected rejection ("refused as it must be"); that test passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YacWmjoxWSZRJC38XYxuZx
bpalermo added a commit to bpalermo/aether that referenced this pull request Nov 1, 2026
… a QUIC listener

#1733's proxy workflow (run 41308410926, both arches) failed
//agent/test/envoy_validate:envoy_validate_test: `envoy --mode validate` of
node_bootstrap.json, edge_bootstrap.json and the ADS reconnect test's
bootstrap died with SIGSEGV in
Quic::ActiveQuicListenerFactory::initializeWorkerRouting().

envoyproxy/envoy#45504, in the 011e396 snapshot, moved the QUIC listener's
socket options there (behind envoy.restart_features.defer_worker_routing_init,
default true) and applies them to every worker's listen socket. Validation
mode creates no sockets (ValidationListenerComponentFactory::createListenSocket
returns nullptr), so *socket dereferences null. Upstream main still has it.
The proxy-supervisor's check before every hot restart on a changed bootstrap
is `envoy --mode validate`, so this would have blocked every bootstrap change
in production.

The patch skips a null socket, which only validation mode produces, as
validation did before #45504. Regression test: envoy_validate_test in the
proxy workflow, red on 8ce601a. Not reported upstream (on hold).

The "FilterStateMatcherValidationError.Key: value length must be at least 1
characters" line in the same log is TestAgentCaptureListenerAndTableValidate's
expected rejection ("refused as it must be"); that test passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YacWmjoxWSZRJC38XYxuZx
bpalermo added a commit to bpalermo/aether that referenced this pull request Nov 1, 2026
…er1054c and aether1074 (proposal 045) (#1733)

* proxy: Envoy 1.41.0-dev.20261028.011e396 under Bazel 9.3.1; drop aether1054c and aether1074 (proposal 045)

- envoy/envoy_api 1.40.0.envoy -> 1.41.0-dev.20261028.011e396.envoy, registry
  a1264b53 -> 36d481b01b (the commit that added the snapshot).
- Dropped patches: aether1054c (envoyproxy/envoy#47868, 2eff6e8ccf) and
  aether1074 (envoyproxy/envoy#47893, 77b512527c), both in the snapshot.
- aether1050 refreshed from envoyproxy/envoy#47834's head against its merge
  base, which already contains #47068: the +/- lines are unchanged, only the
  test file's context moved. aether1054 refreshed by hand: two one-line
  insertions whose neighbouring runtime guards were removed upstream. 47740
  and aether1126 apply unchanged.
- .bazelversion 8.7.0 -> 9.3.1 (Envoy's own; the 1.40.0 closure does not load
  under Bazel 9, so the move cannot land first). .bazelrc follows upstream:
  merge_fixed_and_default_shell_env removed, system_include_paths and the
  rules_rust linker_messages flags added, the toolchains_llvm compiler-rt and
  libunwind overrides dropped (the envoy module links compiler-rt + libunwind
  since envoyproxy/envoy#48641).
- proxy-wasm-cpp-host .envoy -> .envoy.1, rules_cc 0.2.25 -> 0.2.27,
  rules_python 2.3.3 -> 2.4.5: what the new closure selects.
- The MODULE.bazel comment that still called #47893 open is rewritten.

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

* proxy: carry aether1733, envoy --mode validate no longer segfaults on a QUIC listener

#1733's proxy workflow (run 41308410926, both arches) failed
//agent/test/envoy_validate:envoy_validate_test: `envoy --mode validate` of
node_bootstrap.json, edge_bootstrap.json and the ADS reconnect test's
bootstrap died with SIGSEGV in
Quic::ActiveQuicListenerFactory::initializeWorkerRouting().

envoyproxy/envoy#45504, in the 011e396 snapshot, moved the QUIC listener's
socket options there (behind envoy.restart_features.defer_worker_routing_init,
default true) and applies them to every worker's listen socket. Validation
mode creates no sockets (ValidationListenerComponentFactory::createListenSocket
returns nullptr), so *socket dereferences null. Upstream main still has it.
The proxy-supervisor's check before every hot restart on a changed bootstrap
is `envoy --mode validate`, so this would have blocked every bootstrap change
in production.

The patch skips a null socket, which only validation mode produces, as
validation did before #45504. Regression test: envoy_validate_test in the
proxy workflow, red on 8ce601a. Not reported upstream (on hold).

The "FilterStateMatcherValidationError.Key: value length must be at least 1
characters" line in the same log is TestAgentCaptureListenerAndTableValidate's
expected rejection ("refused as it must be"); that test passed.

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

* proxy: aether1733's production exposure is a future static QUIC listener; refresh the extension count

- The aether1733 comment (MODULE.bazel, README) overstated the exposure: the
  chart's bootstraps carry static clusters only (listeners come over LDS), so
  the supervisor's pre-restart `--mode validate` does not crash today. A future
  bootstrap with a static QUIC listener would fail it, and every hot restart.
  The crash needs concurrency > 1 (the BPF reuseport option); raw-UDP
  listeners are unaffected.
- extensions_build_config.bzl: 354 upstream extensions - 35 dropped = 319 at
  011e396. The five new ones are named; tls.certificate_selectors.dynamic_modules
  is dropped by the existing pattern, and the four that compile in
  (priority_load_shed, host_allowlist, uri_template matcher,
  ai_protocol_manager in-memory buffer) are unused by aether and reach none of
  the wasm, dynamic-module or Rust machinery, so the policy keeps them.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
RyanTheOptimist pushed a commit that referenced this pull request Nov 5, 2026
…ate mode (#48982)

Commit Message: quic: Fix
`envoy.restart_features.defer_worker_routing_init` in config validation
mode
Additional Description:

`envoy.restart_features.defer_worker_routing_init` moves creation and
application of quic worker routing sockopt to
`ActiveQuicListenerFactory::initializeWorkerRouting`, which also runs in
`--mode validate`, where listeners have no sockets. Debug builds assert,
opt builds dereference a null socket at concurrency > 1. Return before
touching sockets in validation mode.

Risk Level: Low
Testing: Added unit test
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
Fixes commit #45504

Signed-off-by: Filip Cacky <[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.

6 participants