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(),