Invoking Socket.shutdownInput at around the same time that another thread is attempts to read or is blocked in read on the same Socket has always been problematic on Windows. For virtual threads, the read may fail with a SocketException exception like "A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call". The change proposed here to change the SocketImpl to handle the async shutdownInput and cause read to return -1.
Tests for async shutdownInput and shutdownOutput are added to BlockingSocketsOps. Some minor drive by clean-up to use a value source for the tests that exercise both untimed and timed cases. Similar cleanup in BlockingChannelOps as it tests the socket adapters doing both untimed and timed reads. The existing test for async shutdown with platform threads is migrated to JUnit as part of the change. Testing: tier1 + tier2, test repeat runs of the modified tests to ensure they are stable. ------------- Commit messages: - Initial commit Changes: https://git.openjdk.org/jdk/pull/28626/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28626&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8372958 Stats: 328 lines in 4 files changed: 98 ins; 160 del; 70 mod Patch: https://git.openjdk.org/jdk/pull/28626.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28626/head:pull/28626 PR: https://git.openjdk.org/jdk/pull/28626
