On Wed, 3 Dec 2025 07:47:40 GMT, Alan Bateman <[email protected]> wrote:
> Invoking Socket.shutdownInput at around the same time that another thread > 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. This pull request has now been integrated. Changeset: afb6a0c2 Author: Alan Bateman <[email protected]> URL: https://git.openjdk.org/jdk/commit/afb6a0c2fecdb2114715290d5d463c9dccf93c28 Stats: 328 lines in 4 files changed: 98 ins; 160 del; 70 mod 8372958: SocketInputStream.read throws SocketException instead of returning -1 when input shutdown Reviewed-by: djelinski, michaelm ------------- PR: https://git.openjdk.org/jdk/pull/28626
