RFR: 7116990: (spec) Socket.connect(addr,timeout) not clear if IOException because of TCP timeout [v3]

Jaikiran Pai jpai at openjdk.org
Fri Jun 13 07:12:17 UTC 2025


On Thu, 12 Jun 2025 10:19:21 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

>> 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 a TCP/IP 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.

Hello Mark, I discussed this with Alan and based on those discussions I have now reworded that sentence to make it clear that 60 second isn't the only typical timeout and at the same time keep the text concise.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25690#discussion_r2144350812


More information about the net-dev mailing list