From aab9e0b16ecc8fa00228c00c7ab90e55195cf5f4 Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Sun, 10 May 2020 11:43:04 +0530 Subject: [PATCH] HDFS-15250. Setting `dfs.client.use.datanode.hostname` to true can crash the system because of unhandled UnresolvedAddressException. Contributed by Ctest. --- .../org/apache/hadoop/hdfs/client/impl/BlockReaderFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/BlockReaderFactory.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/BlockReaderFactory.java index 2109e6e1b7e..a3b611c1ca7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/BlockReaderFactory.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/BlockReaderFactory.java @@ -27,6 +27,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.lang.reflect.Constructor; import java.net.InetSocketAddress; +import java.nio.channels.UnresolvedAddressException; import java.util.List; import com.google.common.io.ByteArrayDataOutput; @@ -823,7 +824,7 @@ public class BlockReaderFactory implements ShortCircuitReplicaCreator { datanode); LOG.trace("nextTcpPeer: created newConnectedPeer {}", peer); return new BlockReaderPeer(peer, false); - } catch (IOException e) { + } catch (IOException | UnresolvedAddressException e) { LOG.trace("nextTcpPeer: failed to create newConnectedPeer connected to" + "{}", datanode); throw e;