Repository navigation
hot_restart: fix socket handoff for listeners with network namespace addresses - #43653
Merged
ravenblackx merged 4 commits intoMar 2, 2026
Merged
Conversation
jronak
force-pushed
the
hot-restart-network-namespace
branch
from
February 26, 2026 07:01
3fff32c to
27b1392
Compare
Hot restart socket handoff fails when a listener has network_namespace_filepath configured. The PassListenSocket request only carries the address string, so the parent resolves an address without a namespace that never matches the listener's namespaced address. Thread the network namespace through the PassListenSocket proto, child request, and parent resolution so that namespaced addresses match correctly during hot restart. Signed-off-by: Ronak Jain <[email protected]>
jronak
force-pushed
the
hot-restart-network-namespace
branch
from
February 26, 2026 07:30
27b1392 to
b1597be
Compare
…-namespace Signed-off-by: Ronak Jain <[email protected]> Signed-off-by: Ronak Jain <[email protected]>
jronak
force-pushed
the
hot-restart-network-namespace
branch
from
February 26, 2026 14:49
5c5b442 to
82a31ce
Compare
Contributor
|
/assign @ravenblackx |
RyanTheOptimist
enabled auto-merge (squash)
February 27, 2026 22:30
ravenblackx
requested changes
Feb 27, 2026
ravenblackx
left a comment
Contributor
There was a problem hiding this comment.
Lots of changes but they're all nitpicky, the general thrust of the PR looks great, thanks!
…setup - Use absl::string_view instead of const std::string& for network_namespace parameter across hot restart interfaces - Use std::make_shared instead of raw new for address construction in tests - Simplify ON_CALL mock setup to not specify arg matchers - Use "" instead of std::string() for empty namespace default Signed-off-by: Ronak Jain <[email protected]>
auto-merge was automatically disabled
February 28, 2026 07:46
Head branch was pushed to by a user without write access
Avoids unnecessary local variable by passing the network namespace directly to the function call. Signed-off-by: Ronak Jain <[email protected]>
Contributor
Author
|
/retest |
ravenblackx
approved these changes
Mar 2, 2026
Contributor
|
Normally this would need approval from a senior maintainer too since it touches core code - I'm going to assume @RyanTheOptimist previously enabling auto-merge counts as that endorsement. |
bmjask
pushed a commit
to bmjask/envoy
that referenced
this pull request
Mar 14, 2026
…addresses (envoyproxy#43653) Commit Message: Hot restart socket handoff fails when a listener has `network_namespace_filepath` configured. The `PassListenSocket` request only carries the address string (e.g. `tcp://0.0.0.0:80`), the network namespace is lost. On the parent side, `resolveUrl` produces an address with `networkNamespace() == nullopt`, which never matches the listener's namespaced address (since `operator==` checks namespace equality). The result is `fd == -1`, the child falls back to binding a new socket, breaking handoff. This PR fixes it by passing the network namespace hot restart socket handoff path in child and parent handling. Risk Level: Low, only affects listeners with `network_namespace_filepath` set, which were already broken during hot restart. Testing: Updated and added unit tests in `hot_restarting_parent_test.cc` covering namespace match, mismatch, and mixed (namespace vs no-namespace) cases. Docs Changes: Updated Changelog Release Notes: NA Platform Specific Features: NA --------- Signed-off-by: Ronak Jain <[email protected]> Signed-off-by: bjmask <[email protected]>
bvandewalle
pushed a commit
to bvandewalle/envoy
that referenced
this pull request
Mar 17, 2026
…addresses (envoyproxy#43653) Commit Message: Hot restart socket handoff fails when a listener has `network_namespace_filepath` configured. The `PassListenSocket` request only carries the address string (e.g. `tcp://0.0.0.0:80`), the network namespace is lost. On the parent side, `resolveUrl` produces an address with `networkNamespace() == nullopt`, which never matches the listener's namespaced address (since `operator==` checks namespace equality). The result is `fd == -1`, the child falls back to binding a new socket, breaking handoff. This PR fixes it by passing the network namespace hot restart socket handoff path in child and parent handling. Risk Level: Low, only affects listeners with `network_namespace_filepath` set, which were already broken during hot restart. Testing: Updated and added unit tests in `hot_restarting_parent_test.cc` covering namespace match, mismatch, and mixed (namespace vs no-namespace) cases. Docs Changes: Updated Changelog Release Notes: NA Platform Specific Features: NA --------- Signed-off-by: Ronak Jain <[email protected]>
fishcakez
pushed a commit
to fishcakez/envoy
that referenced
this pull request
Mar 25, 2026
…addresses (envoyproxy#43653) Commit Message: Hot restart socket handoff fails when a listener has `network_namespace_filepath` configured. The `PassListenSocket` request only carries the address string (e.g. `tcp://0.0.0.0:80`), the network namespace is lost. On the parent side, `resolveUrl` produces an address with `networkNamespace() == nullopt`, which never matches the listener's namespaced address (since `operator==` checks namespace equality). The result is `fd == -1`, the child falls back to binding a new socket, breaking handoff. This PR fixes it by passing the network namespace hot restart socket handoff path in child and parent handling. Risk Level: Low, only affects listeners with `network_namespace_filepath` set, which were already broken during hot restart. Testing: Updated and added unit tests in `hot_restarting_parent_test.cc` covering namespace match, mismatch, and mixed (namespace vs no-namespace) cases. Docs Changes: Updated Changelog Release Notes: NA Platform Specific Features: NA --------- Signed-off-by: Ronak Jain <[email protected]>
krinkinmu
pushed a commit
to grnmeira/envoy
that referenced
this pull request
Apr 20, 2026
…addresses (envoyproxy#43653) Commit Message: Hot restart socket handoff fails when a listener has `network_namespace_filepath` configured. The `PassListenSocket` request only carries the address string (e.g. `tcp://0.0.0.0:80`), the network namespace is lost. On the parent side, `resolveUrl` produces an address with `networkNamespace() == nullopt`, which never matches the listener's namespaced address (since `operator==` checks namespace equality). The result is `fd == -1`, the child falls back to binding a new socket, breaking handoff. This PR fixes it by passing the network namespace hot restart socket handoff path in child and parent handling. Risk Level: Low, only affects listeners with `network_namespace_filepath` set, which were already broken during hot restart. Testing: Updated and added unit tests in `hot_restarting_parent_test.cc` covering namespace match, mismatch, and mixed (namespace vs no-namespace) cases. Docs Changes: Updated Changelog Release Notes: NA Platform Specific Features: NA --------- Signed-off-by: Ronak Jain <[email protected]>
mattklein123
pushed a commit
that referenced
this pull request
Sep 30, 2026
…pace (#47492) ### Commit Message hot restart: inherit listen sockets before entering the network namespace ### Additional Description Follow-up to #43653. A listener whose address sets `network_namespace_filepath` is created by running the whole socket creation, including the request to the hot restart parent, inside the target namespace. If the namespace path can no longer be opened (typical when a CNI plugin removes the pod namespace pin after the socket was bound) the namespace switch fails before the parent is ever asked, so the successor rejects the listener (`lds.update_rejected`, `listener_create_failure`) and the port goes dead once the parent finishes draining, even though the parent still holds a valid socket bound in that namespace. An in-place LDS update of the same listener masks this, since it clones the socket factory without reopening the namespace; the loss only shows up at the next hot restart. The successor now asks the parent for the socket before entering the namespace: an inherited socket is already bound in the right namespace and needs no `setns` to be duplicated. Entering the namespace to bind a fresh socket only happens when the parent has none, so creating a new listener in a missing namespace still fails cleanly. ### Risk Level Low. Only affects listeners with `network_namespace_filepath`, and only reorders the existing parent-socket request ahead of the namespace switch. ### Testing New unit tests in `listener_manager_impl_test`: the parent hands over a socket and the namespace file is never opened; without a parent socket a missing namespace path still fails the listener. Reproduced the loss manually with file-based LDS, a bind-mounted namespace file, and `--restart-epoch` 1 then 2 with the namespace removed in between. ### Docs Changes N/A ### Release Notes Added a bug-fix changelog fragment. ### Platform Specific Features Linux only (network namespaces). --------- Signed-off-by: Bruno Palermo <[email protected]>
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.
Commit Message: Hot restart socket handoff fails when a listener has
network_namespace_filepathconfigured. ThePassListenSocketrequest only carries the address string (e.g.tcp://0.0.0.0:80), the network namespace is lost. On the parent side,resolveUrlproduces an address withnetworkNamespace() == nullopt, which never matches the listener's namespaced address (sinceoperator==checks namespace equality). The result isfd == -1, the child falls back to binding a new socket, breaking handoff.This PR fixes it by passing the network namespace hot restart socket handoff path in child and parent handling.
Risk Level: Low, only affects listeners with
network_namespace_filepathset, which were already broken during hot restart.Testing: Updated and added unit tests in
hot_restarting_parent_test.cccovering namespace match, mismatch, and mixed (namespace vs no-namespace) cases.Docs Changes: Updated Changelog
Release Notes: NA
Platform Specific Features: NA