You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@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.


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

Posted by "Johannes Zillmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-6797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12873963#action_12873963 ] 

Johannes Zillmann commented on HADOOP-6797:
-------------------------------------------

In case we would add or replace the fallback with :
{noformat}
InetAddress.getByName(ips[ctr]).getCanonicalHostName()
{noformat}

the default ip would match up again with the default dns.

> 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.


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

Posted by "Johannes Zillmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-6797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875116#action_12875116 ] 

Johannes Zillmann commented on HADOOP-6797:
-------------------------------------------

not sure if this could happen, but probably a good idea.

> 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.


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

Posted by "Steve Loughran (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-6797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875105#action_12875105 ] 

Steve Loughran commented on HADOOP-6797:
----------------------------------------

adding code to catch when {{InetAddress.getByName(ips[ctr])}} was null, presumably?

> 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.


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

Posted by "Steve Loughran (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-6797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875120#action_12875120 ] 

Steve Loughran commented on HADOOP-6797:
----------------------------------------

Anything can go wrong with networking given a sufficiently large number of machines. 
HADOOP-3426 covers machines throwing exceptions on getting their local name, HDFS-116 is an NPE triggered by the same machine's "issues"


> 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.