HDFS-15250. Setting `dfs.client.use.datanode.hostname` to true can crash the system because of unhandled UnresolvedAddressException. Contributed by Ctest.

This commit is contained in:
Ayush Saxena 2020-05-10 11:43:04 +05:30
parent 763a79916d
commit 6ccb1cd5f1
1 changed files with 2 additions and 1 deletions

View File

@ -27,6 +27,7 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.nio.channels.UnresolvedAddressException;
import java.util.List; import java.util.List;
import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteArrayDataOutput;
@ -823,7 +824,7 @@ public class BlockReaderFactory implements ShortCircuitReplicaCreator {
datanode); datanode);
LOG.trace("nextTcpPeer: created newConnectedPeer {}", peer); LOG.trace("nextTcpPeer: created newConnectedPeer {}", peer);
return new BlockReaderPeer(peer, false); return new BlockReaderPeer(peer, false);
} catch (IOException e) { } catch (IOException | UnresolvedAddressException e) {
LOG.trace("nextTcpPeer: failed to create newConnectedPeer connected to" LOG.trace("nextTcpPeer: failed to create newConnectedPeer connected to"
+ "{}", datanode); + "{}", datanode);
throw e; throw e;