Skip to content

HDDS-17135. Bracket IPv6 literals passed to NetUtils.createSocketAddr and in Recon datanode JMX URLs - #11619

Merged
smengcl merged 2 commits into
apache:masterfrom
smengcl:HDDS-17135
Oct 21, 2026
Merged

smengcl merged 2 commits into
apache:masterfrom
smengcl:HDDS-17135

Conversation

@smengcl

@smengcl smengcl commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

Several production paths pass a host that can be a bare IPv6 literal to NetUtils.createSocketAddr(target, defaultPort), or format it into a URL without brackets. Hadoop parses target as a URI authority, so a bare literal such as 2001:db8::10 throws IllegalArgumentException: Does not contain a valid host:port authority. Bare literals reach these paths because SCM records a datanode's IP with InetAddress.getHostAddress() (and its hostname is the literal when there is no reverse DNS), and NodeDetails takes its host address from InetSocketAddress.getHostName().

Affected paths:

  • NodeDetails.getRpcAddress(): OM bootstrap (checkRemoteOMConfig, addOMToRatisRing) throws when the remote OM's host address is a bare literal.
  • SCMHANodeDetails.loadSCMHAConfig: SCM HA fails to start with an unbracketed ozone.scm.address.<serviceId>.<nodeId>, although validateAdvertisedHost accepts it.
  • XceiverClientManager.getPipelineCacheKey and XceiverClientShortCircuit: with short circuit reads enabled, every non EC read from an IPv6 datanode fails.
  • DataNodeMetricsCollectionTask (Recon): the datanode JMX URL is malformed, so pending deletion metrics are reported as -1.
  • DiskBalancerSubCommandUtil.getSingleNodeDiskBalancerProxy: any : was taken to mean "port given", so [2001:db8::1] threw instead of using the default port, and a bare literal failed with an unhelpful error.
  • ozone local: with --host ::1, service addresses, the Recon endpoint and the startup summary became ::1:9860.

The fix combines host and port with HddsUtils.getHostPortString, and parses the DiskBalancer and SCM HA addresses with HddsUtils.getHostName / getHostPort. These bracket IPv6 literals and accept DNS names, IPv4 literals and already bracketed input. This follows the same pattern as HDDS-15773 and HDDS-16831.

The DiskBalancer CLI now rejects an unbracketed IPv6 address, because 2001:db8::1:1234 could mean either a host with port 1234 or a whole literal. It uses HddsUtils.validateHostPortAuthority (now public), the same check ozone.scm.names and ozone.recon.address use, and the error message suggests the bracketed form to use.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-17135

How was this patch tested?

New unit tests. The bare IPv6 cases fail without the fix; the DNS, IPv4 and bracketed cases guard against regressions:

  • TestOMNodeDetails: unbracketed IPv6 host address.
  • TestSCMConfiguration: SCM HA peer with unbracketed and bracketed IPv6 address.
  • TestDataNodeMetricsCollectionTask (new): JMX URL for a DNS name and an IPv6 literal over HTTP and HTTPS.
  • TestDiskBalancerSubCommandUtil: address parsing for IPv4 and bracketed IPv6, with and without a port, and rejection of unbracketed IPv6 with and without a trailing port.
  • TestLocalOzoneCluster and TestOzoneLocal: service addresses, Recon endpoint and startup summary with --host ::1.

🤖 Generated with Claude Code

… and in Recon datanode JMX URLs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 19, 2026 02:11

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added tools Tools that helps with debugging command-line labels Oct 19, 2026

@Gargi-jais11 Gargi-jais11 left a comment

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.

Thanks @smengcl for the patch.
Left one comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@smengcl

smengcl commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Gargi-jais11 for reviewing this. Would you like to take another look?

@Gargi-jais11
Gargi-jais11 marked this pull request as ready for review October 21, 2026 04:09

@Gargi-jais11 Gargi-jais11 left a comment

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.

Thanks @smengcl for updating the patch.
LGTM, +1!

@smengcl

smengcl commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Gargi-jais11 for the review.

@smengcl
smengcl merged commit 12448d6 into apache:master Oct 21, 2026
126 of 127 checks passed
@smengcl
smengcl deleted the HDDS-17135 branch October 21, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants