RFR: 7180557 - InetAddress.getLocalHost throws UnknownHostException on java7u5 on OSX

Rob McKenna rob.mckenna at oracle.com
Fri Sep 13 16:00:45 PDT 2013


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/20130914/dec444f9/attachment.html 


More information about the net-dev mailing list