Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6413593

InetAddress.getByName does reverse DNS for literal ip addresses

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6
    • core-libs
    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      java version "1.6.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59g)
      Java HotSpot(TM) Client VM (build 1.6.0-beta-b59g, mixed mode, sharing)

      also verified for:

      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      testes for 1.6.0 beta and 1.5.0_06

      A DESCRIPTION OF THE PROBLEM :
      InetAddress.getByName(), when provided with a literal v4 ip address, tries a reverse dns lookup, although the documentation states otherwise: "If a literal IP address is supplied, only the validity of the address format is checked."

      On windows, this will produce a delay of about 4.5 seconds for this call.

      Seems to be related to issue 5092063


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. make sure that a reverse DNS resolution fails for the IP specified in the code below, and/or start an ethereal trace
      2. excute the code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      response time should be faster
      ACTUAL -
      1.6.0-beta
      address=192.168.42.42
      4515 ms

      and

      1.5.0_06
      address=192.168.42.42
      4500 ms


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.net.*;

      class Test {

      public static void main(String args[]) throws Exception {


      System.out.println(System.getProperty("java.version"));
      long before = System.currentTimeMillis();
      InetAddress addr = InetAddress.getByName("192.168.42.42");
      System.out.println("address=" + addr.getHostName());
      long after = System.currentTimeMillis();
      System.out.println((after - before) + " ms");

      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      fixing dns reverse lookup, e.g. by putting the ip's as names into the local hosts file, if practical.

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: