RFR: 8370655: Check EINTR handling InetAddress implementation and NET_ThrowNew [v4]

Michael McMahon michaelm at openjdk.org
Tue Dec 16 14:22:59 UTC 2025


> 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

Michael McMahon has updated the pull request incrementally with one additional commit since the last revision:

  whitespace fix

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28750/files
  - new: https://git.openjdk.org/jdk/pull/28750/files/f170dea7..363b86e1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28750&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28750&range=02-03

  Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/28750.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28750/head:pull/28750

PR: https://git.openjdk.org/jdk/pull/28750


More information about the net-dev mailing list