From 4a583385e43f743da51cfec6eb803a66cf4590b8 Mon Sep 17 00:00:00 2001 From: runzhiwang Date: Sun, 13 Oct 2019 12:46:16 +0800 Subject: [PATCH] [LIVY-697] Rsc client cannot resolve the hostname of driver in yarn-cluster mode --- rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java b/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java index d67b78a6c..c59136d55 100644 --- a/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java +++ b/rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java @@ -27,6 +27,7 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; +import java.net.InetSocketAddress; import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; @@ -340,7 +341,9 @@ void dispose() { } private void handle(ChannelHandlerContext ctx, RemoteDriverAddress msg) { - ContextInfo info = new ContextInfo(msg.host, msg.port, clientId, secret); + InetSocketAddress insocket = (InetSocketAddress) ctx.channel().remoteAddress(); + String ip = insocket.getAddress().getHostAddress(); + ContextInfo info = new ContextInfo(ip, msg.port, clientId, secret); if (promise.trySuccess(info)) { timeout.cancel(true); LOG.debug("Received driver info for client {}: {}/{}.", client.getChannel(),