You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xy...@apache.org on 2018/06/08 17:12:51 UTC
[30/50] hadoop git commit: HADOOP-15512. Clean up Shell from JDK7
workarounds. Contributed by Zsolt Venczel.
HADOOP-15512. Clean up Shell from JDK7 workarounds.
Contributed by Zsolt Venczel.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/f494f0b8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/f494f0b8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/f494f0b8
Branch: refs/heads/HDDS-4
Commit: f494f0b8968a61bf3aa32b7ca0851b8c744aa70f
Parents: 58bc34f
Author: Steve Loughran <st...@apache.org>
Authored: Thu Jun 7 15:55:49 2018 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Jun 7 15:55:49 2018 +0100
----------------------------------------------------------------------
.../main/java/org/apache/hadoop/util/Shell.java | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/f494f0b8/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
index 04b4b4f..0b76f0d 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
@@ -22,7 +22,6 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.InputStream;
import java.io.InterruptedIOException;
import java.nio.charset.Charset;
import java.util.Arrays;
@@ -1018,17 +1017,7 @@ public abstract class Shell {
}
// close the input stream
try {
- // JDK 7 tries to automatically drain the input streams for us
- // when the process exits, but since close is not synchronized,
- // it creates a race if we close the stream first and the same
- // fd is recycled. the stream draining thread will attempt to
- // drain that fd!! it may block, OOM, or cause bizarre behavior
- // see: https://bugs.openjdk.java.net/browse/JDK-8024521
- // issue is fixed in build 7u60
- InputStream stdout = process.getInputStream();
- synchronized (stdout) {
- inReader.close();
- }
+ inReader.close();
} catch (IOException ioe) {
LOG.warn("Error while closing the input stream", ioe);
}
@@ -1037,10 +1026,7 @@ public abstract class Shell {
joinThread(errThread);
}
try {
- InputStream stderr = process.getErrorStream();
- synchronized (stderr) {
- errReader.close();
- }
+ errReader.close();
} catch (IOException ioe) {
LOG.warn("Error while closing the error stream", ioe);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org