From b0d3781b64bcb4850feb143a81a4dd2ce125d4a6 Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Fri, 9 Dec 2011 23:16:15 +0000 Subject: [PATCH] MAPREDUCE-3519. Fixed a deadlock in NodeManager LocalDirectories's handling service. Contributed by Ravi Gummadi. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1212680 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 ++ .../nodemanager/LocalDirsHandlerService.java | 36 ++++--------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 565bd8bb0e..b5db4770a8 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -258,6 +258,9 @@ Release 0.23.1 - Unreleased MAPREDUCE-3513. Capacity Scheduler web UI has a spelling mistake for Memory. (chackaravarthy via mahadev) + MAPREDUCE-3519. Fixed a deadlock in NodeManager LocalDirectories's handling + service. (Ravi Gummadi via vinodkv) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LocalDirsHandlerService.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LocalDirsHandlerService.java index 1e143f6676..52e860012a 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LocalDirsHandlerService.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LocalDirsHandlerService.java @@ -249,49 +249,27 @@ private void updateDirsInConfiguration() { conf.setStrings(YarnConfiguration.NM_LOCAL_DIRS, localDirs.toArray(new String[localDirs.size()])); List logDirs = getLogDirs(); - synchronized(conf) { - conf.setStrings(YarnConfiguration.NM_LOG_DIRS, + conf.setStrings(YarnConfiguration.NM_LOG_DIRS, logDirs.toArray(new String[logDirs.size()])); - } } public Path getLocalPathForWrite(String pathStr) throws IOException { - Configuration conf = getConfig(); - Path path = null; - synchronized (conf) { - path = localDirsAllocator.getLocalPathForWrite(pathStr, conf); - } - return path; + return localDirsAllocator.getLocalPathForWrite(pathStr, getConfig()); } public Path getLocalPathForWrite(String pathStr, long size, boolean checkWrite) throws IOException { - Configuration conf = getConfig(); - Path path = null; - synchronized (conf) { - path = localDirsAllocator.getLocalPathForWrite(pathStr, size, conf, - checkWrite); - } - return path; + return localDirsAllocator.getLocalPathForWrite(pathStr, size, getConfig(), + checkWrite); } public Path getLogPathForWrite(String pathStr, boolean checkWrite) throws IOException { - Configuration conf = getConfig(); - Path path = null; - synchronized (conf) { - path = logDirsAllocator.getLocalPathForWrite(pathStr, - LocalDirAllocator.SIZE_UNKNOWN, conf, checkWrite); - } - return path; + return logDirsAllocator.getLocalPathForWrite(pathStr, + LocalDirAllocator.SIZE_UNKNOWN, getConfig(), checkWrite); } public Path getLogPathToRead(String pathStr) throws IOException { - Configuration conf = getConfig(); - Path path = null; - synchronized (conf) { - path = logDirsAllocator.getLocalPathToRead(pathStr, conf); - } - return path; + return logDirsAllocator.getLocalPathToRead(pathStr, getConfig()); } }