Siyao Meng created HADOOP-20095:
-----------------------------------

             Summary: 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


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