YARN-3594. WintuilsProcessStubExecutor.startStreamReader leaks streams. Contributed by Lars Francke.

This commit is contained in:
Junping Du 2015-05-22 04:23:25 -07:00
parent 0c6638c2ea
commit 132d909d4a
2 changed files with 6 additions and 6 deletions

View File

@ -256,6 +256,9 @@ Release 2.8.0 - UNRELEASED
YARN-3684. Changed ContainerExecutor's primary lifecycle methods to use a more YARN-3684. Changed ContainerExecutor's primary lifecycle methods to use a more
extensible mechanism of context objects. (Sidharta Seethana via vinodkv) extensible mechanism of context objects. (Sidharta Seethana via vinodkv)
YARN-3594. WintuilsProcessStubExecutor.startStreamReader leaks streams.
(Lars Francke via junping_du)
OPTIMIZATIONS OPTIMIZATIONS
YARN-3339. TestDockerContainerExecutor should pull a single image and not YARN-3339. TestDockerContainerExecutor should pull a single image and not

View File

@ -501,17 +501,14 @@ private Thread startStreamReader(final InputStream stream)
@Override @Override
public void run() { public void run() {
try try (BufferedReader lines = new BufferedReader(
{ new InputStreamReader(stream, Charset.forName("UTF-8")))) {
BufferedReader lines = new BufferedReader(
new InputStreamReader(stream, Charset.forName("UTF-8")));
char[] buf = new char[512]; char[] buf = new char[512];
int nRead; int nRead;
while ((nRead = lines.read(buf, 0, buf.length)) > 0) { while ((nRead = lines.read(buf, 0, buf.length)) > 0) {
output.append(buf, 0, nRead); output.append(buf, 0, nRead);
} }
} } catch (Throwable t) {
catch(Throwable t) {
LOG.error("Error occured reading the process stdout", t); LOG.error("Error occured reading the process stdout", t);
} }
} }