Siyao Meng created HDDS-17135:
---------------------------------
Summary: Bracket IPv6 literals passed to NetUtils.createSocketAddr
and in Recon datanode JMX URLs
Key: HDDS-17135
URL: https://issues.apache.org/jira/browse/HDDS-17135
Project: Apache Ozone
Issue Type: Bug
Reporter: Siyao Meng
Assignee: Siyao Meng
Several production paths still pass a host that can be a bare IPv6 literal to
{{NetUtils.createSocketAddr(String target, int defaultPort)}}, or format it
into a URL without brackets.
In Hadoop 3.4.3, {{createSocketAddr(target, defaultPort)}} parses {{target}} as
a URI authority ({{"dummyscheme://" + target}}). For a bare literal such as
{{2001:db8::10}} the URI host is null and the call 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()}}. It also records the datanode hostname with
{{getHostName()}}, which returns the literal when there is no reverse DNS.
Likewise {{NodeDetails}} takes its host address from
{{InetSocketAddress.getHostName()}}.
h3. Affected paths
# {{NodeDetails.getRpcAddress()}} (hdds-common):
{{NetUtils.createSocketAddr(hostAddress, rpcPort)}}.
{{OMNodeDetails.getFromProtobuf}} and the OM bootstrap handler build node
details from the remote OM's host address. When that address is a bare literal,
{{OzoneManager.checkRemoteOMConfig}} and {{addOMToRatisRing}} ->
{{getRatisHostPortStr()}} throw an unchecked {{IllegalArgumentException}}.
# {{SCMHANodeDetails.loadSCMHAConfig}} (server-scm):
{{NetUtils.createSocketAddr(rpcAddrStr, ratisPort)}}.
{{validateAdvertisedHost}} and {{SCMNodeInfo}} accept an unbracketed
{{ozone.scm.address.<serviceId>.<nodeId>}} such as {{2001:db8::2}}, but this
call throws for it, so SCM HA fails to start.
# {{XceiverClientManager.getPipelineCacheKey}} and the
{{XceiverClientShortCircuit}} constructor (hdds-client):
{{NetUtils.createSocketAddr(dn.getIpAddress(), port)}}. With
{{ozone.client.read.short-circuit=true}}, every non-EC read from an IPv6
datanode fails.
# {{DataNodeMetricsCollectionTask.getJmxMetricsUrl}} (Recon):
{{String.format("%s://%s:%d/jmx", ...)}} with the datanode hostname. The URL is
malformed for a literal host, so the datanode's pending-deletion metrics are
reported as -1.
h3. Fix
Combine the host and port with {{HddsUtils.getHostPortString(host, port)}},
which brackets IPv6 literals and accepts DNS names, IPv4 literals and
already-bracketed input. This is the same pattern used by HDDS-15773 and
HDDS-16831.
h3. Testing
Unit tests cover:
* {{OMNodeDetails}} with an unbracketed IPv6 host address
* SCM HA configuration with unbracketed and bracketed IPv6 peer addresses
* the Recon datanode JMX URL for a DNS name and an IPv6 literal over HTTP and
HTTPS
The IPv6-only acceptance test (HDDS-16969) does not catch these because compose
resolves nodes by DNS name.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]