JDK 8 RFR 8010371: getaddrinfo can fail with EAI_SYSTEM/EAGAIN, causes UnknownHostException to be thrown

Brian Burkhalter brian.burkhalter at oracle.com
Tue Oct 1 18:59:55 UTC 2013


On Oct 1, 2013, at 11:50 AM, Alan Bateman wrote:

> On 01/10/2013 11:31, Brian Burkhalter wrote:
>> Hello net-dev members,
>> 
>> Please review this proposed fix at your convenience.
>> 
>> Summary
>> When looking up a host and an EAGAIN error is encountered, throw an instance of the new HostLookupException subclass of UnknownHostException.
>> 
>> Issue
>> https://bugs.openjdk.java.net/browse/JDK-8010371
>> 
>> Webrev
>> http://cr.openjdk.java.net/~bpb/8010371
>> 
>> 
> So is getaddrinfo returning EAGAIN or is it failing with EAI_SYSTEM and errno set to EAGAIN?

It seems a bit unclear to me and to depend on which system one is on. There is also the possibility apparently of it returning EAI_AGAIN. It might be best to test both the return value and if that is EAI_SYSTEM to test errno.

> I also wonder if the EAGAIN means the underlying syscall has been interrupted, in which case the normal thing to do is to retry.

The approach I initially was going to take was to retry once after a short wait and then fail with the proposed exception if the retry failed.

This webrev was intended to provoke discussion such as this is the first time I have looked at this part of the code base and it is not clear how to actually test this situation.

Brian


More information about the core-libs-dev mailing list