JDK-8170910: Avoid 5 second localhost lookup behavior on OSX

Alan Bateman Alan.Bateman at oracle.com
Wed Apr 3 06:33:11 UTC 2019


On 02/04/2019 23:35, Nora Howard wrote:
> On OSX 10.12 or later, when no mDNS services are registered, getaddrinfo
> fails on looking up localhost addresses[1]. The jdk’s current
> implementation falls back to getifaddrs after getaddrinfo fails[2]. When
> getaddrinfo fails in this way, it takes 5 seconds to fail [3]. This means
> that calls to InetAddress.getLocalHost() may take up to 5 seconds to run.
>
> I’d like to change the jdk’s behavior in this instance so that instead of
> falling back to calling getifaddrs after getaddrinfo fails, it instead
> calls getifaddrs first if we’re on OSX and the hostname is localhost’s.
>
Can you bring this to net-dev to discussion? You will probably need to 
provide a lot of information on the environment where this occurs and 
also be prepared to do testing on lots of different configurations to 
make sure that there aren't any regressions.

-Alan


More information about the jdk-dev mailing list