You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by pn...@apache.org on 2021/05/06 07:45:00 UTC

[flink] branch master updated: [FLINK-22362][network] Improve error message when taskmanager can not connect to jobmanager

This is an automated email from the ASF dual-hosted git repository.

pnowojski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 14295d2  [FLINK-22362][network] Improve error message when taskmanager can not connect to jobmanager
14295d2 is described below

commit 14295d28f63d30c3633f7f290e79dfd6936d7915
Author: gentlewangyu <yu...@gmail.com>
AuthorDate: Tue Apr 20 11:29:57 2021 +0800

    [FLINK-22362][network] Improve error message when taskmanager can not connect to jobmanager
---
 .../org/apache/flink/runtime/net/ConnectionUtils.java     | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java
index 3c5e394..c4f9d28 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java
@@ -334,14 +334,12 @@ public class ConnectionUtils {
     private static boolean tryToConnect(
             InetAddress fromAddress, SocketAddress toSocket, int timeout, boolean logFailed)
             throws IOException {
+        String detailedMessage =
+                String.format(
+                        "connect to [%s] from local address [%s] with timeout [%s]",
+                        toSocket, fromAddress, timeout);
         if (LOG.isDebugEnabled()) {
-            LOG.debug(
-                    "Trying to connect to ("
-                            + toSocket
-                            + ") from local address "
-                            + fromAddress
-                            + " with timeout "
-                            + timeout);
+            LOG.debug("Trying to " + detailedMessage);
         }
         try (Socket socket = new Socket()) {
             // port 0 = let the OS choose the port
@@ -351,8 +349,7 @@ public class ConnectionUtils {
             socket.connect(toSocket, timeout);
             return true;
         } catch (Exception ex) {
-            String message =
-                    "Failed to connect from address '" + fromAddress + "': " + ex.getMessage();
+            String message = "Failed to " + detailedMessage + " due to: " + ex.getMessage();
             if (LOG.isDebugEnabled()) {
                 LOG.debug(message, ex);
             } else if (logFailed) {