HDDS-16307. Construct listeners from separate host and port values - #11130
Draft
rjgoyln wants to merge 1 commit into
Draft
HDDS-16307. Construct listeners from separate host and port values#11130rjgoyln wants to merge 1 commit into
rjgoyln wants to merge 1 commit into
Conversation
Setting any bind-host property to an IPv6 literal, including the wildcard ::, stopped the service from starting. The host and port were joined by string concatenation before being handed to NetUtils.createSocketAddr, and a bare IPv6 literal followed by a plain colon and a port is ambiguous, so parsing failed with "Does not contain a valid host:port authority". The same concatenation ran again once a server had bound and its real listen address was written back into configuration. That turned a correct address into one whose port is silently dropped on the next read, leaving the HTTP and RPC endpoints unrecoverable from configuration as well. Generated-by: Claude Code (Opus 5)
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.
What changes were proposed in this pull request?
A bind-host property set to an IPv6 literal — including the wildcard
::— stops the service from starting. Ozone joins host and port by string concatenation before parsing the result, so::and port 9860 become:::9860, which has no unambiguous host, andNetUtils.createSocketAddrrejects it with "Does not contain a valid host:port authority". The listener is never bound.Every listener-construction site now combines through
HddsUtils.getHostPortString, the bracket-aware helper added in HDDS-15768. That covers the SCM client, block, security and datanode endpoints and their SCM HA per-node equivalents, the datanode client RPC endpoint, the OM RPC and peer HTTP endpoints, and — throughBaseHttpServer.getBindAddress— every HTTP and HTTPS listener in the project.Three sites undid that fix further along the same code path by re-serializing an address that had already been built correctly: the Jetty endpoint URI, and the two places that write a server's real listen address back into configuration once it has bound. An unbracketed authority written there is read back as a bare host with the port silently dropped, so the endpoint cannot be recovered from configuration either. These used Hadoop's
NetUtils.getHostPortString(InetSocketAddress), which does not bracket; a bracket-aware overload of the Ozone helper replaces it.IPv4 and DNS behaviour is unchanged, since a host is bracketed only when it contains a colon, and no configuration property or bind default changes. Advertised-address validation stays with the second sub-task of HDDS-15778, along with the four remaining call sites that render advertised peer identities.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16307
How was this patch tested?
New and extended unit tests in
TestHddsUtils,TestHddsServerUtil,TestScmUtils,TestBaseHttpServer,TestServerUtilsandTestOmUtils, each confirmed to fail without the production change. The existing IPv4 and DNS assertions in those classes are kept, so the unchanged defaults stay covered.updateConnectorAddresshas no dedicated test: asserting on it needs a server actually bound to::, whose accepted address families depend on the operating system'sIPV6_V6ONLYhandling. That qualification belongs with the IPv6 test environment in HDDS-15779.Generated-by: Claude Code (Opus 5)