You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Johannes Zillmann (JIRA)" <ji...@apache.org> on 2010/06/01 13:47:37 UTC

[jira] Created: (HADOOP-6797) DNS#getHosts() fallback leads to mix of network-interface addresse in case reverse lookup fails

DNS#getHosts() fallback leads to mix of network-interface addresse in case reverse lookup fails
-----------------------------------------------------------------------------------------------

                 Key: HADOOP-6797
                 URL: https://issues.apache.org/jira/browse/HADOOP-6797
             Project: Hadoop Common
          Issue Type: Bug
    Affects Versions: 0.20.2
            Reporter: Johannes Zillmann


org.apache.hadoop.net.DNS#getHosts():
{noformat}
public static String[] getHosts(String strInterface, String nameserver)
    throws UnknownHostException {
    String[] ips = getIPs(strInterface);
    Vector<String> hosts = new Vector<String>();
    for (int ctr = 0; ctr < ips.length; ctr++)
      try {
        hosts.add(reverseDns(InetAddress.getByName(ips[ctr]),
                             nameserver));
      } catch (Exception e) {
      }

    if (hosts.size() == 0)
      return new String[] { InetAddress.getLocalHost().getCanonicalHostName() };
    else
      return hosts.toArray(new String[] {});
  }
{noformat}

I have the situation where i choosing eth1 as network interface (fs.datanode.dns.interface and mapred.tasktracker.dns.interface) which is the internal interface.
The reverse lookup fails for eth1 so the fallback:
{noformat}
    if (hosts.size() == 0)
      return new String[] { InetAddress.getLocalHost().getCanonicalHostName() };
{noformat}
comes to action. The dns of eth0 is returned which is the external interface.

This leads in my case to a combination of internal ip and external dns as the default ip/host.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.