Integrated: 8358496: Concurrent reading from Socket with timeout executes sequentially

Alan Bateman alanb at openjdk.org
Wed Jun 4 09:55:20 UTC 2025


On Tue, 3 Jun 2025 12:56:49 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> If several threads attempt to read from a Socket's input stream at the same time then all but the winner will block trying to acquire the read lock.  This is okay for untimed-reads but surprising for timed-reads as the timeout is only effective after acquiring the lock. The SocketImpl is changed so that the timeout applies to the total time waiting to acquire and read.
> 
> A new test is added to the existing java/net/Socket/Timeouts test. It is migrated from TestNG to a JUnit test as a drive-by change - it's mostly mechanical and the changes kept as minimal as possible.

This pull request has now been integrated.

Changeset: 7838321b
Author:    Alan Bateman <alanb at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/7838321b74276e45b92c54904ea31ef70ed9e33f
Stats:     174 lines in 2 files changed: 68 ins; 11 del; 95 mod

8358496: Concurrent reading from Socket with timeout executes sequentially

Reviewed-by: dfuchs

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

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


More information about the net-dev mailing list