From 4475d8bfe76a9939a4e611fe7903fbc17f180137 Mon Sep 17 00:00:00 2001 From: AngersZhuuuu Date: Sat, 25 Sep 2021 18:17:44 +0800 Subject: [PATCH] HDFS-16235. Fix Deadlock in LeaseRenewer for static remove method (#3472) (cherry picked from commit 5f9321a5d4112e7b4ee9e6b948ce46a2b152a2db) --- .../java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java index 6b4c899454..fcacdaa6a7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/LeaseRenewer.java @@ -96,7 +96,9 @@ public static LeaseRenewer getInstance(final String authority, * @param renewer Instance to be cleared from Factory */ public static void remove(LeaseRenewer renewer) { - Factory.INSTANCE.remove(renewer); + synchronized (renewer) { + Factory.INSTANCE.remove(renewer); + } } /**