RFR: 8285515: (dc) DatagramChannel.disconnect fails with "Invalid argument" on macOS 12.4 beta2 [v4]

Jaikiran Pai jpai at openjdk.java.net
Thu Apr 28 12:52:37 UTC 2022


> Can I please get a review of this change with proposes to address the issue reported in https://bugs.openjdk.java.net/browse/JDK-8285515?
> 
> We have noticed that in the latest 12.4 Beta2 version of MacOSX, the implementation of `DatagramChannelImpl.disconnect` fails with an unexpected error. 
> 
> Internally, the disconnect is implemented as a call to `connect` by passing it a "null" address as suggested in the documentation of `man connect`. In previous versions of MacOSX, this call used to return a `EADDRNOTAVAIL` errno and at the same time would correctly dissolve the connected association. The `EADDRNOTAVAIL` was then caught and intentionally ignored by the code in the JNI layer in `DatagramChannelImpl.disconnect0`.
> 
> In MacOSX 12.4 Beta 2 we are now seeing this `connect` call return `EINVAL`. This change in behaviour is noticed only for IPv4-mapped IPv6 addresses.
> 
> The `man connect` documentation on MacOSX states that even `disconnectx` can be used to disconnect datagram sockets. The commit here does that change to use `disconnectx` for MacOSX. Tests have been successfully run on some older Mac setups  to make sure this change passes there as well.
> 
> Currently `tier1`, `tier2` and `tier3` run is in progress across various OS.
> 
> No additional tests have been added for this change since the many existing (failing) tests already cover this use case.

Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision:

 - Alan's suggestion - add @bug to just one test
 - Revert "add @bug 8285515 to testcases that failed without this change"
   
   This reverts commit fd05ea6028edaad32b4b4160328792e889e14843.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8445/files
  - new: https://git.openjdk.java.net/jdk/pull/8445/files/fd05ea60..16de5522

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8445&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8445&range=02-03

  Stats: 8 lines in 4 files changed: 0 ins; 0 del; 8 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8445.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8445/head:pull/8445

PR: https://git.openjdk.java.net/jdk/pull/8445


More information about the nio-dev mailing list