Repository navigation
hot restart: inherit listen sockets before entering the network namespace - #47492
Merged
mattklein123 merged 2 commits intoSep 30, 2026
Merged
Conversation
…pace A listener whose address carries network_namespace_filepath is created by running the whole socket creation, including the request to the hot restart parent, inside the target namespace. When the namespace path can no longer be opened (e.g. it was removed after the parent bound the socket) the namespace switch fails before the parent is ever asked, so the successor rejects the listener and the port dies once the parent finishes draining, even though the parent still holds a valid socket bound in that namespace. Ask 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. Only fall back to entering the namespace to create a fresh socket when the parent has none, so creating a new listener in a missing namespace still fails cleanly. Signed-off-by: Bruno Palermo <[email protected]>
Signed-off-by: Bruno Palermo <[email protected]>
This was referenced Sep 27, 2026
mattklein123
approved these changes
Sep 30, 2026
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: inherit listen sockets before entering the network namespace
Additional Description
Follow-up to #43653. A listener whose address sets
network_namespace_filepathis created byrunning 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 thoughthe 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
setnsto be duplicated. Entering thenamespace 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 existingparent-socket request ahead of the namespace switch.
Testing
New unit tests in
listener_manager_impl_test: the parent hands over a socket and the namespacefile 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-epoch1 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).