From ab7ecd6a0f1e067147c1e155692c9b0114cb64ad Mon Sep 17 00:00:00 2001 From: paulward24 <52216289+paulward24@users.noreply.github.com> Date: Fri, 28 Jun 2019 16:06:43 -0700 Subject: [PATCH] HDFS-14618. Incorrect synchronization of ArrayList field (ArrayList is thread-unsafe). Contributed by Paul Ward. (cherry picked from commit d203045c3024b134d7a0417d1ea3a60d03a1534a) --- .../server/blockmanagement/PendingReconstructionBlocks.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingReconstructionBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingReconstructionBlocks.java index 0f20daae397..d0af60c6d2b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingReconstructionBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingReconstructionBlocks.java @@ -132,7 +132,9 @@ class PendingReconstructionBlocks { public void clear() { synchronized (pendingReconstructions) { pendingReconstructions.clear(); - timedOutItems.clear(); + synchronized (timedOutItems) { + timedOutItems.clear(); + } timedOutCount = 0L; } }