From f7d387003496cf96eab397ac4198a61033d597a3 Mon Sep 17 00:00:00 2001 From: Junping Du Date: Fri, 15 Jan 2016 08:40:56 -0800 Subject: [PATCH] YARN-4581. AHS writer thread leak makes RM crash while RM is recovering. Contributed by sandflee. (cherry picked from commit fc6d3a3b234efff2b0b646c31a4e6ff0a5118ef9) Conflicts: hadoop-yarn-project/CHANGES.txt (cherry picked from commit e09222306f65227d14fe1e656102d225b232409c) Conflicts: hadoop-yarn-project/CHANGES.txt --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../FileSystemApplicationHistoryStore.java | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 63b9ad14999..b4fe340f1b1 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -63,6 +63,9 @@ Release 2.7.3 - UNRELEASED YARN-4121. Fix typos in capacity scheduler documentation. (Kai Sasaki via vvasudev) + YARN-4581. AHS writer thread leak makes RM crash while RM is recovering. + (sandflee via junping_du) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java index 6d76864b07f..c340b190252 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/FileSystemApplicationHistoryStore.java @@ -734,12 +734,17 @@ public class FileSystemApplicationHistoryStore extends AbstractService } else { fsdos = fs.create(historyFile); } - fs.setPermission(historyFile, HISTORY_FILE_UMASK); - writer = - new TFile.Writer(fsdos, MIN_BLOCK_SIZE, getConfig().get( - YarnConfiguration.FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE, - YarnConfiguration.DEFAULT_FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE), null, - getConfig()); + try { + fs.setPermission(historyFile, HISTORY_FILE_UMASK); + writer = + new TFile.Writer(fsdos, MIN_BLOCK_SIZE, getConfig().get( + YarnConfiguration.FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE, + YarnConfiguration.DEFAULT_FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE), null, + getConfig()); + } catch (IOException e) { + IOUtils.cleanup(LOG, fsdos); + throw e; + } } public synchronized void close() {