You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Ye Xianjin (JIRA)" <ji...@apache.org> on 2014/08/14 17:10:11 UTC

[jira] [Created] (SPARK-3040) pick up a more proper local ip address for Utils.findLocalIpAddress method

Ye Xianjin created SPARK-3040:
---------------------------------

             Summary: pick up a more proper local ip address for Utils.findLocalIpAddress method
                 Key: SPARK-3040
                 URL: https://issues.apache.org/jira/browse/SPARK-3040
             Project: Spark
          Issue Type: Improvement
          Components: Spark Core
    Affects Versions: 1.0.2
         Environment: Mac os x, a bunch of network interfaces: eth0, wlan0, vnic0, vnic1, tun0, lo
            Reporter: Ye Xianjin
            Priority: Trivial


I noticed this inconvenience when I ran spark-shell with my virtual machines on and VPN service running.

There are a lot of network interfaces on my laptop(inactive devices omitted):
{quote}
lo0: inet 127.0.0.1
en1: inet 192.168.0.102
vnic0: inet 10.211.55.2 (virtual if for vm1)
vnic1: inet 10.37.129.3 (virtual if for vm2)
tun0: inet 172.16.100.191 --> 172.16.100.191 (tun device for VPN)
{quote}

In spark core, Utils.findLocalIpAddress() uses NetworkInterface.getNetworkInterfaces to get all active network interfaces, but unfortunately, this method returns network interfaces in reverse order compared to the ifconfig output (both use ioctl sys call). I dug into the openJDK 6 and 7 source code and confirms this behavior(It just happens on unix-like system, windows deals with it and returns in index order). So, the findLocalIpAddress method will pick the ip address associated with tun0 rather than en1




--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org