Integrated: 8370655: Check EINTR handling InetAddress implementation and NET_ThrowNew
Michael McMahon
michaelm at openjdk.org
Wed Dec 17 08:58:24 UTC 2025
On Wed, 10 Dec 2025 15:29:51 GMT, Michael McMahon <michaelm at openjdk.org> wrote:
> Hi,
>
> This change updates the use of NET_ThrowNew in Inet4AddressImpl.c + Inet6AddressImpl.c (unix).
> Currently EINTR is incorrectly handled in NET_ThrowNew to throw InterruptedIOException.
>
> The only possible places in these files where EINTR can be returned is in the sendto() calls
> for ping4() and ping6() used by the InetAddress.isReachable() API.
>
> The change checks for EINTR returned from those calls and restarts the sendto()
> if the timeout allows it. If EINTR is detected by NET_ThrowNew it is thrown as an ordinary
> SocketException, but this should not happen.
>
> The fix is only partially tested as it is difficult to make sendto() return EINTR in practice, but
> I added a unit test for the new native function that checks if the timeout has expired.
>
> Thanks,
> Michael
This pull request has now been integrated.
Changeset: 4924b29f
Author: Michael McMahon <michaelm at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/4924b29fa519996b806ac0f4a7c898085f44bc4c
Stats: 66 lines in 5 files changed: 33 ins; 4 del; 29 mod
8370655: Check EINTR handling InetAddress implementation and NET_ThrowNew
Reviewed-by: alanb
-------------
PR: https://git.openjdk.org/jdk/pull/28750
More information about the net-dev
mailing list