bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/91583] New: InetAddress performs an unnecessary reverse l


From: guillerodriguez.dev at gmail dot com
Subject: [Bug classpath/91583] New: InetAddress performs an unnecessary reverse lookup of the ANY_IF address
Date: Wed, 28 Aug 2019 16:31:17 +0000

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91583

            Bug ID: 91583
           Summary: InetAddress performs an unnecessary reverse lookup of
                    the ANY_IF address
           Product: classpath
           Version: 0.99
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guillerodriguez.dev at gmail dot com
  Target Milestone: ---

The InetAddress class creates a ANY_IF object in its static initializer. This
will map to 0.0.0.0 for IP4, or to :: for IP6. Then it tries to retrieve the
hostname for this address.

This is pointless (this is a special, invalid address which should not have an
associated hostname). Normally this is more or less harmless: in a typical
configuration it will result in DNS reverse lookups, which should fail fast
with NXDOMAIN (but it is still unnecessary overhead).

But there are cases (for example if the application runs at boot time and the
network is not yet fully up) where this can additionally lead to DNS timeouts.
See, for example:

 * https://www-01.ibm.com/support/docview.wss?uid=swg1IV60564
 *
https://unix.stackexchange.com/questions/537502/timeout-on-reverse-lookup-of-0-0-0-0/

Also, OpenJDK avoids this reverse lookup by making up "fake" hostnames for
these addresses, presumably to avoid this kind of problems.

 *
https://github.com/openjdk-mirror/jdk7u-jdk/blob/f4d80957e89a19a29bb9f9807d2a28351ed7f7df/src/share/classes/java/net/Inet4AddressImpl.java#L43
 *
https://github.com/openjdk-mirror/jdk7u-jdk/blob/f4d80957e89a19a29bb9f9807d2a28351ed7f7df/src/share/classes/java/net/Inet6AddressImpl.java#L84


reply via email to

[Prev in Thread] Current Thread [Next in Thread]