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 in...@apache.org on 2016/10/03 22:58:32 UTC
[19/57] [abbrv] hadoop git commit: HADOOP-11780. Prevent IPC reader
thread death. Contributed by Daryn Sharp.
HADOOP-11780. Prevent IPC reader thread death. Contributed by Daryn Sharp.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e19b37ea
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e19b37ea
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e19b37ea
Branch: refs/heads/HDFS-10467
Commit: e19b37ead23805c7ed45bdcbfa7fdc8898cde7b2
Parents: 9b0fd01
Author: Kihwal Lee <ki...@apache.org>
Authored: Wed Sep 28 08:24:21 2016 -0500
Committer: Kihwal Lee <ki...@apache.org>
Committed: Wed Sep 28 08:24:21 2016 -0500
----------------------------------------------------------------------
.../main/java/org/apache/hadoop/ipc/Server.java | 25 +++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e19b37ea/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
index 531d574..f509d71 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
@@ -110,6 +110,7 @@ import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
import org.apache.hadoop.security.token.SecretManager;
import org.apache.hadoop.security.token.SecretManager.InvalidToken;
import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.util.ProtoUtil;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.Time;
@@ -956,10 +957,16 @@ public abstract class Server {
while (iter.hasNext()) {
key = iter.next();
iter.remove();
- if (key.isValid()) {
+ try {
if (key.isReadable()) {
doRead(key);
}
+ } catch (CancelledKeyException cke) {
+ // something else closed the connection, ex. responder or
+ // the listener doing an idle scan. ignore it and let them
+ // clean up.
+ LOG.info(Thread.currentThread().getName() +
+ ": connection aborted from " + key.attachment());
}
key = null;
}
@@ -969,6 +976,9 @@ public abstract class Server {
}
} catch (IOException ex) {
LOG.error("Error in Reader", ex);
+ } catch (Throwable re) {
+ LOG.fatal("Bug in read selector!", re);
+ ExitUtil.terminate(1, "Bug in read selector!");
}
}
}
@@ -1187,8 +1197,17 @@ public abstract class Server {
SelectionKey key = iter.next();
iter.remove();
try {
- if (key.isValid() && key.isWritable()) {
- doAsyncWrite(key);
+ if (key.isWritable()) {
+ doAsyncWrite(key);
+ }
+ } catch (CancelledKeyException cke) {
+ // something else closed the connection, ex. reader or the
+ // listener doing an idle scan. ignore it and let them clean
+ // up
+ RpcCall call = (RpcCall)key.attachment();
+ if (call != null) {
+ LOG.info(Thread.currentThread().getName() +
+ ": connection aborted from " + call.connection);
}
} catch (IOException e) {
LOG.info(Thread.currentThread().getName() + ": doAsyncWrite threw exception " + e);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org