upstream: gracefully handle upstream connection creation failure#45975
Open
bpalermo wants to merge 1 commit into
Open
upstream: gracefully handle upstream connection creation failure#45975bpalermo wants to merge 1 commit into
bpalermo wants to merge 1 commit into
Conversation
Binding an upstream connection to a configured Linux network namespace (SocketAddress.network_namespace_filepath) could crash Envoy when the namespace did not exist: DispatcherImpl::createClientConnection returns nullptr on netns failure, and the result was dereferenced unconditionally in HostImplBase::createConnection. HostImplBase::createConnection now returns a null connection in this case, and the TCP/HTTP1/HTTP2/mixed connection pools surface it as a FailedToCreateConnection pool failure -- matching how the HTTP/3 pool already behaves -- instead of crashing. Signed-off-by: Bruno Palermo <b@palermo.dev>
|
Hi @bpalermo, 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. |
This was referenced Jul 4, 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
upstream: gracefully handle upstream connection creation failure
Additional Description
Split out of #45721 (crash-fix half), as requested in review.
Binding an upstream connection to a configured Linux network namespace
(
SocketAddress.network_namespace_filepath) could crash Envoy when the namespace was notavailable:
DispatcherImpl::createClientConnectionreturnsnullptron netns failure, and theresult was dereferenced unconditionally in
HostImplBase::createConnection.HostImplBase::createConnectionnow returns a null connection in this case, and theTCP/HTTP1/HTTP2/mixed connection pools surface it as a
FailedToCreateConnectionpool failure(
LocalConnectionFailureto the caller) — matching how the HTTP/3 pool already behaves — insteadof crashing.
The companion PR (#45976) adds opt-in validation of the network namespace at config load time.
Risk Level
Low — converts a crash into the existing graceful pool-failure path.
Testing
Unit tests added:
HostImplTest.CreateConnectionFailure(null connection surfaced byHostImplBase::createConnection) andTcpConnPoolImplDestructorTest.ConnectionCreationFailure(pool surfaces
LocalConnectionFailure).Docs Changes
N/A
Release Notes
Added a bug-fix changelog fragment.
Platform Specific Features
The motivating failure (network namespace binding) is Linux-only, but the null-connection
handling is platform-independent.