On Wed, 11 Jun 2025 21:16:40 GMT, Mark Sheppard <mshep...@openjdk.org> wrote:
>>> Alan @AlanBateman, do you suggest we continue with this text or would any >>> update be necessary? >> >> I think it's helpful here to give some indication in this API note as what >> the timeout might be. It doesn't really matter if it says 60s or 75s, the >> point is that establishing a TCP connection is subject to a timeout imposed >> by the operating system. It helps for cases where someone calls connect with >> a timeout of say 300_000 (5 minutes) and is surprised to get >> ConnectException "Operation timed out" after a minute or so. This is exactly >> what prompted JDK-7116990, someone called connect with a timeout that is >> larger than the OS configured timeout. > > Looking at this on the 3 main OS platforms (Windows, OL and macOS) and > running a simple test to trigger a connect timeout then finding are > > macOS the connect timeout is 75 seconds as this is derived from 4.3 BSD > > If OL linux has a syn retries set to 6 and an RTO == 1 sec then it’s connect > timeout is 130 seconds approx > That’s initial syn timeout of 1 seconds and then 6 retries totalling 127 > seconds > > Windows by default connect timeout is 21 seconds > RTT == 3 seconds and two connect retries > Initial syn timeout 3 seconds + 2 retries at 6 and 12 seconds == 21 seconds FWIW an possible alternative wording Establishing a TCP/IP connection is subject to a connect timeout, determined by configuration settings of the operating system, for example the number of connect retries together with an implementation’s back off strategy. Thus, TCP/IP Connect timeout values can vary across operating system, for example 75 seconds on macOS, with a default value of 21 seconds on Windows system. As such, the operating system TCP/IP Connect timeout may expire before that specified to the connect method. If the operating system Connect timeout expires before the {@code timeout} specified to this method then an {@code IOException} is thrown. The {@code timeout} specified to this method is typically a timeout value that is shorter than the operating system timeout. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25690#discussion_r2142282586