From 2736f8856144c8361be3821cd1c158ef2d9a2dec Mon Sep 17 00:00:00 2001 From: Szilard Nemeth Date: Mon, 16 Oct 2023 15:17:58 -0400 Subject: [PATCH] YARN.11590. RM process stuck after calling confStore.format() when ZK SSL/TLS is enabled, as netty thread waits indefinitely. Contributed by Ferenc Erdelyi --- .../yarn/server/resourcemanager/ResourceManager.java | 9 +++++---- .../scheduler/capacity/conf/YarnConfigurationStore.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java index 90eaed3d8a..f358a22cee 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java @@ -1903,10 +1903,11 @@ static void deleteRMConfStore(Configuration conf) throws Exception { } if (scheduler instanceof MutableConfScheduler && isConfigurationMutable) { - YarnConfigurationStore confStore = YarnConfigurationStoreFactory - .getStore(conf); - confStore.initialize(conf, conf, rmContext); - confStore.format(); + try (YarnConfigurationStore confStore = YarnConfigurationStoreFactory + .getStore(conf)) { + confStore.initialize(conf, conf, rmContext); + confStore.format(); + } } else { System.out.println(String.format("Scheduler Configuration format only " + "supported by %s.", MutableConfScheduler.class.getSimpleName())); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/YarnConfigurationStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/YarnConfigurationStore.java index 0f44f43905..2ec2ea442a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/YarnConfigurationStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/YarnConfigurationStore.java @@ -44,7 +44,7 @@ * {@code getPendingMutations}, and replay/confirm them via * {@code confirmMutation} as in the normal case. */ -public abstract class YarnConfigurationStore { +public abstract class YarnConfigurationStore implements AutoCloseable { public static final Logger LOG = LoggerFactory.getLogger(YarnConfigurationStore.class);