From ef7ab535c550cd094114ac0b05a7248d29ba0537 Mon Sep 17 00:00:00 2001 From: Haoze Wu <18595686+functioner@users.noreply.github.com> Date: Sat, 6 Mar 2021 08:26:16 -0500 Subject: [PATCH] HADOOP-17552. Change ipc.client.rpc-timeout.ms from 0 to 120000 by default to avoid potential hang. (#2727) --- .../java/org/apache/hadoop/fs/CommonConfigurationKeys.java | 2 +- .../hadoop-common/src/main/resources/core-default.xml | 5 +++-- .../src/test/java/org/apache/hadoop/ipc/TestIPC.java | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java index c08af395ad..07776763e9 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java @@ -58,7 +58,7 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic { public static final String IPC_CLIENT_RPC_TIMEOUT_KEY = "ipc.client.rpc-timeout.ms"; /** Default value for IPC_CLIENT_RPC_TIMEOUT_KEY. */ - public static final int IPC_CLIENT_RPC_TIMEOUT_DEFAULT = 0; + public static final int IPC_CLIENT_RPC_TIMEOUT_DEFAULT = 120000; /** Responses larger than this will be logged */ public static final String IPC_SERVER_RPC_MAX_RESPONSE_SIZE_KEY = "ipc.server.max.response.size"; diff --git a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml index c4edc5d614..11b790408b 100644 --- a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml +++ b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml @@ -2383,9 +2383,10 @@ ipc.client.rpc-timeout.ms - 0 + 120000 Timeout on waiting response from server, in milliseconds. - If ipc.client.ping is set to true and this rpc-timeout is greater than + If this rpc-timeout is 0, it means no timeout. If this rpc-timeout is greater + than 0, and ipc.client.ping is set to true, and this rpc-timeout is greater than the value of ipc.ping.interval, the effective value of the rpc-timeout is rounded up to multiple of ipc.ping.interval. diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java index 32881523fd..d486c7ea13 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java @@ -1456,6 +1456,7 @@ public void run() { @Test public void testClientGetTimeout() throws IOException { Configuration config = new Configuration(); + config.setInt(CommonConfigurationKeys.IPC_CLIENT_RPC_TIMEOUT_KEY, 0); assertThat(Client.getTimeout(config)).isEqualTo(-1); }