Siyao Meng created YARN-12037:
---------------------------------

             Summary: NodeManager web port parsed with split(":")[1] breaks for 
a bracketed IPv6 address
                 Key: YARN-12037
                 URL: https://issues.apache.org/jira/browse/YARN-12037
             Project: Hadoop YARN
          Issue Type: Bug
          Components: yarn-native-services, nodemanager
            Reporter: Siyao Meng
            Assignee: Siyao Meng


Two places take the port of {{yarn.nodemanager.webapp.address}} as 
{{split(":")[1]}}:
* 
[NMTimelinePublisher.java:117|https://github.com/apache/hadoop/blob/1097744bc490b65cad5ab2fbeafff35687971357/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java#L117]
* 
[ServiceScheduler.java:1087|https://github.com/apache/hadoop/blob/1097744bc490b65cad5ab2fbeafff35687971357/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/ServiceScheduler.java#L1087]

{{[::]:8042}} gives an empty string and {{[2001:db8::21]:8042}} gives {{db8}}. 
This happens with DNS too, as soon as the address is configured as an IPv6 
literal.

{{NMTimelinePublisher}} then publishes {{nodeId.getHost() + ":" + httpPort}} 
(L136, also unbracketed) as {{ALLOCATED_HOST_HTTP_ADDRESS_INFO}}. 
{{LogWebService}} reads that value and {{LogServlet}} redirects to it, so the 
redirect goes to {{host:}} or {{host:db8}}. {{ServiceScheduler}} builds its 
sysfs PUT URL from the same port and the unbracketed container host. 
{{AggregatedLogsBlock.java:138}} has the same split, but the result is only 
shown as text.

Verified by running the splits on JDK 21 and tracing the code. Not run with 
Timeline Service v2 or a YARN service.

*Proposed fix:* parse with 
{{NetUtils.createSocketAddrUnresolved(addr).getPort()}} and compose with 
{{NetUtils.getHostPortString(host, port)}}.

POC: 
https://github.com/smengcl/hadoop/commit/efc0f3f52cc2425af252bad91509dc5a2f034180
 (NMTimelinePublisher) and 
https://github.com/smengcl/hadoop/commit/d4009c263cd14a6f3ebe6a259996c901eeac4f6e
 (ServiceScheduler)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to