From 8a77a224c734bea0eb490f30c908748458c190c3 Mon Sep 17 00:00:00 2001 From: Yiqun Lin Date: Fri, 9 Aug 2019 18:38:57 -0700 Subject: [PATCH] HDFS-13359. DataXceiver hung due to the lock in FsDatasetImpl#getBlockInputStream. Contributed by Yiqun Lin. Signed-off-by: Wei-Chiu Chuang --- .../hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java index fb365d833b..03f90240f1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java @@ -794,7 +794,7 @@ public InputStream getBlockInputStream(ExtendedBlock b, long seekOffset) throws IOException { ReplicaInfo info; - synchronized(this) { + try (AutoCloseableLock lock = datasetLock.acquire()) { info = volumeMap.get(b.getBlockPoolId(), b.getLocalBlock()); }