RFR: 7180557 - InetAddress.getLocalHost throws UnknownHostException on java7u5 on OSX
Rob McKenna
rob.mckenna at oracle.com
Fri Sep 20 07:58:33 PDT 2013
After a brief discussion with Chris, we decided to revert the position
of the call to lookupIfLocalAddrs so as to give the local host primacy
over DNS.
Latest (and hopefully last) webrev here:
http://cr.openjdk.java.net/~robm/7180557/webrev.03/
-Rob
On 14/09/13 00:00, Rob McKenna wrote:
> Hi Bernd,
>
> I should have said in the context of this bug. What I meant was
> removing AI_CANONNAME doesn't resolve the issue as far as Mac is
> concerned. I.e. I still see the UnknownHostException. In this
> particular case the hostname is not set via the hosts file.
>
> In the latest webrev the call to getifaddrs only occurs if getaddrinfo
> fails.
>
> -Rob
>
> On 13/09/13 20:28, Bernd Eckenfels wrote:
>> Am 13.09.2013, 19:32 Uhr, schrieb Rob McKenna <rob.mckenna at oracle.com>:
>>> W.r.t. the use of AI_CANONNAME, this doesn't actually make a
>>> difference in the context of this fix, but is definitely something
>>> that should be looked at. I'll put it on the todo list.
>>
>> I think it does make a difference: If you remove the CANON flag
>> getaddrinfo() will not do DNS lookups when the host is configured to
>> prefer the hosts file (which it should do on Linux and OSX). And so
>> the platform specific lookupIfLocalhost() can be put after the
>> getaddrinfo() (again).
>>
>> I actually think the bug "exists" on all platforms. If getaddrinfo()
>> fails because neighter hosts nor DNS file finds the name this can
>> happen on all platforms. I dont think it helps to add a fallback only
>> on MACOSX (and there is certainly no need to prefer the fallback then).
>>
>> Gruss
>> Bernd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20130920/058d7240/attachment.html
More information about the net-dev
mailing list