From 132d909d4a6509af9e63e24cbb719be10006b6cd Mon Sep 17 00:00:00 2001 From: Junping Du Date: Fri, 22 May 2015 04:23:25 -0700 Subject: [PATCH] YARN-3594. WintuilsProcessStubExecutor.startStreamReader leaks streams. Contributed by Lars Francke. --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../nodemanager/WindowsSecureContainerExecutor.java | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 59d6ee649a..c98bfe3be8 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -256,6 +256,9 @@ Release 2.8.0 - UNRELEASED YARN-3684. Changed ContainerExecutor's primary lifecycle methods to use a more extensible mechanism of context objects. (Sidharta Seethana via vinodkv) + YARN-3594. WintuilsProcessStubExecutor.startStreamReader leaks streams. + (Lars Francke via junping_du) + OPTIMIZATIONS YARN-3339. TestDockerContainerExecutor should pull a single image and not diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java index 0aa9d0357d..fd2e31b7b4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java @@ -501,17 +501,14 @@ private Thread startStreamReader(final InputStream stream) @Override public void run() { - try - { - BufferedReader lines = new BufferedReader( - new InputStreamReader(stream, Charset.forName("UTF-8"))); + try (BufferedReader lines = new BufferedReader( + new InputStreamReader(stream, Charset.forName("UTF-8")))) { char[] buf = new char[512]; int nRead; while ((nRead = lines.read(buf, 0, buf.length)) > 0) { output.append(buf, 0, nRead); } - } - catch(Throwable t) { + } catch (Throwable t) { LOG.error("Error occured reading the process stdout", t); } }