RFR: 8227493: Return a more useful error message from lookupAllHostAddr if getaddrinfo results in EAI_SYSTEM error [v3]

Jaikiran Pai jpai at openjdk.org
Thu Jan 29 15:03:38 UTC 2026


On Thu, 29 Jan 2026 14:59:49 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Can I please get a review of this minor enhancement to the error text that is reported if the `getaddrinfo()` native call returns the `EAI_SYSTEM` error? This addresses https://bugs.openjdk.org/browse/JDK-8227493.
>> 
>> The `java.net.InetAddress` class, in its implementation for resolving addresses for a host name, calls the `getaddrinfo()` native call on *nix platforms. If `getaddrinfo()` returns an error then we use the `gai_strerror()` native call to convert the error number into an error string that is then propagated to the application. Among other errors, the `getaddrinfo()` is specified to return the error code `EAI_SYSTEM` which as per its documentation represents
>> 
>>> EAI_SYSTEM        system error returned in errno
>> 
>> So calling `gai_strerror()` merely returns a generic "System error" text. The real underlying error is present in the `errno` and that has more useful information. 
>> 
>> The commit in this PR checks the error for `EAI_SYSTEM` and if it matches then it additionally gets the error text corresponding to `errno`. So the error text that gets propagated will now be "System error: Illegal byte sequence", assuming `EILSEQ` was the underlying `errno` for the `getaddrinfo` call (my use of `EILSEQ` in this example is arbitrary and it's merely to show what the error text will look like after this change).
>> 
>> Given the nature of this change no new test has been introduced. Existing tests in tier1, tier2 and tier3 continue to pass with this change.
>
> Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
> 
>  - merge latest from master branch
>  - fix size computation
>  - 8227493: lookupAllHostAddr does not handle EAI_SYSTEM correctly

I wasn't able to take this PR to completion, the last time I opened it. I have now refreshed it with the latest set of changes. Can I please get a review afresh please? tier testing is currently in progress with this change.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22484#issuecomment-3818250450


More information about the net-dev mailing list