[ 
https://issues.apache.org/jira/browse/HADOOP-20095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150749#comment-18150749
 ] 

ASF GitHub Bot commented on HADOOP-20095:
-----------------------------------------

smengcl opened a new pull request, #9030:
URL: https://github.com/apache/hadoop/pull/9030

   Generated-by: Claude Code (Opus 5.5)
   
   JIRA: https://issues.apache.org/jira/browse/HADOOP-20095
   
   ### Description of PR
   
   A client JVM with `-Djava.net.preferIPv4Stack=true` that connects to an IPv6 
endpoint (for example a DataNode registered by IPv6 address on a dual stack 
cluster) fails in `NetUtils.connect` with a bare, unchecked 
`java.nio.channels.UnsupportedAddressTypeException` that names neither the 
endpoint nor the cause.
   
   `NetUtils.connect` now catches it and throws a `SocketException` naming the 
endpoint and the likely cause, with the original exception as the cause, the 
same way it already translates `UnresolvedAddressException`.
   
   ### How was this patch tested?
   
   New `TestNetUtils#testConnectUnsupportedAddressType`. Also reproduced the 
original failure on a dual stack cluster with an IPv4-only HDFS client.
   
   ### For code changes:
   
   - [x] Does the title or this PR starts with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   




> NetUtils.connect should report the endpoint when the socket cannot use its 
> address type
> ---------------------------------------------------------------------------------------
>
>                 Key: HADOOP-20095
>                 URL: https://issues.apache.org/jira/browse/HADOOP-20095
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Siyao Meng
>            Priority: Major
>
> On a dual stack cluster where DataNodes register IPv6 addresses, a client JVM 
> started with {{-Djava.net.preferIPv4Stack=true}} fails every block read and 
> write with a bare unchecked exception that names neither the target nor the 
> reason:
> {noformat}
> java.nio.channels.UnsupportedAddressTypeException
>       at sun.nio.ch.Net.checkAddress(Net.java:...)
>       at sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:...)
>       at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:...)
>       at 
> org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:...)
>       at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:...)
> {noformat}
> {{NetUtils.connect}} already translates {{SocketTimeoutException}} and 
> {{UnresolvedAddressException}} into IOExceptions. 
> {{UnsupportedAddressTypeException}} is a RuntimeException, so it escapes the 
> IOException handling of callers (for example the DFS client retry and dead 
> node logic) and gives the user nothing to act on.
> Proposal: catch it in {{NetUtils.connect}} and throw a {{SocketException}} 
> that names the endpoint and the likely cause (an IPv6 address used from a JVM 
> with {{java.net.preferIPv4Stack=true}}), keeping the original exception as 
> the cause.
> Workarounds for affected clients are to drop {{preferIPv4Stack=true}} or set 
> {{dfs.client.use.datanode.hostname=true}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to