On Oct 10, 2013, at 6:52 AM, Alan Bateman wrote:
> Thanks for persevering with this, we are on the right road now.
>
> I just looked at JDK-8010371 and the "OS" field is set to "linux". I don't
> know if this is right but as IPv6 is usually enabled by default these days
> then I have to guess that the person that submitted the bug has IPv6 disabled
> or is running with -Djava.net.preferIPv4Stack=true, otherwise it would be a
> non-issue (as you have discovered).
>
> The other thing about your observation is that
> ThrowUnknownHostExceptionWithGaiError is creating the UHE with the both the
> hostname and the error message. This resolves to the concern in one or two of
> the mails that the UHE names the exception message "host" and that someone
> might assume that the exception detail is the hostname.
>
> So thumbs up on the update to src/solaris/native/java/net/Inet4Address.c.
Thanks.
>> For Windows I added a similar NET_ ThrowUnknownHostExceptionWithGaiError and
>> modified Inet{4,6} to mimic the Unix case. Note that the Windows code has
>> not yet been compiled pending comments.
>>
> Inet4AddressImpl.lookupAllHostAddr uses gethostbyname and when I look at the
> MSDN documentation then I don't see EAI_AGAIN as possible error. It does list
> WSATRY_AGAIN and I'm wondering if they have the same value and whether the
> WSA* error is only returned by WSAGetLastError?
This symbolic name definition
#define EAI_AGAIN WSATRY_AGAIN
is at line 99 of net_util_mh. which is included by net_util.h hence the two
aforementioned values are the same.
> However I think we have a problem with using gai_strerror here as the MSDN
> documentation says that it is not thread safe. This means we may have to look
> for a WSA equivalent or maybe drop the Windows part of the fix (using a mutex
> of some synchronization might be possible but the scope would require
> research and of course it wouldn't work with 3rd party native code that is
> also using it).
Yes, I read about the thread safety. There are other ways to do this but I
wanted first to air the general idea using gai_strerror() before doing any
further work.
> getaddrinfo could return EAI_AGAIN[1]
>
> But recomended way is to just check return value of getaddrinfo and then
> use WSA functions especially, FormatMessage[2] instead of gai_strerror.
Thanks, I did read about FormatMessage() but forewent the usage thereof for the
just stated reason.
> Also we may consider rewriting this code using GetAddrInfoW sometimes in
> a future to support IDN.
>
> PS:
> Brian, please notice mixing WSA and EAI at ll. 137.
Agreed, that indeed should be changed as EAI_AGAIN -> WSATRY_AGAIN.
Thanks,
Brian