Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-18087

fix bugs when looking up record from upstream DNS servers.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.2
    • None
    • registry

    Description

      When query A record which is chained by CNAME, YARN Registry DNS Server does not properly respond. Some CNAME records are missing.

      For example, "repo.maven.apache.org" is chaned as follows:

      repo.maven.apache.org. 21317 IN CNAME repo.apache.maven.org.
      repo.apache.maven.org. 20114 IN CNAME maven.map.fastly.net.
      maven.map.fastly.net. 7 IN A 199.232.192.215
      maven.map.fastly.net. 7 IN A 199.232.196.215

      If ask A record for "repo.maven.apache.org" using "dig" or "nslookup", YARN Registry DNS Server will give answers similar to this:
      (10.1.2.3, 10.8.8.8 IP is virtual)

      $ nslookup repo.maven.apache.org 10.1.2.3
      Server:		10.1.2.3
      Address:	10.1.2.3#53
      
      Non-authoritative answer:
      repo.maven.apache.org	canonical name = repo.apache.maven.org.
      Name:	maven.map.fastly.net
      Address: 151.101.196.215
      ** server can't find repo.apache.maven.org: NXDOMAIN
      

      The reason why you can see "NXDOMAIN", "nslookup" will query "A" & "AAAA" records.
      If there is no answer from other dns server, "answers == null" but YARN Registry DNS Server has a bug. There is no null handling.

          // Forward lookup to primary DNS servers
          Record[] answers = getRecords(name, type);
          try {
            for (Record r : answers) {
              if (!response.findRecord(r)) {
                if (r.getType() == Type.SOA) {
                  response.addRecord(r, Section.AUTHORITY);
                } else {
                  response.addRecord(r, Section.ANSWER);
                }
              }
              if (r.getType() == Type.CNAME) {
                Name cname = r.getName();
                if (iterations < 6) {
                  remoteLookup(response, cname, type, iterations + 1);
                }
              }
            }
          } catch (NullPointerException e) {
            return Rcode.NXDOMAIN;
          } catch (Throwable e) {
            return Rcode.SERVFAIL;
          }
          return Rcode.NOERROR;
      

      It should be like this:

      nslookup repo.maven.apache.org 10.8.8.8
      Server:		10.8.8.8
      Address:	10.8.8.8#53
      
      Non-authoritative answer:
      repo.maven.apache.org	canonical name = repo.apache.maven.org.
      repo.apache.maven.org	canonical name = maven.map.fastly.net.
      Name:	maven.map.fastly.net
      Address: 151.101.196.215
      

      I will make a pull request at https://github.com/apache/hadoop soon.

      Attachments

        Activity

          People

            Unassigned Unassigned
            eub YUBI LEE
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3h
                3h