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

Alan Bateman alanb at openjdk.org
Wed Jun 11 12:41:31 UTC 2025


On Wed, 11 Jun 2025 12:14:59 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

>> Hello Mark,
>> Alan's thought was that it might be OK to have that sentence about the typical 60 second timeout. The primary guidance to developers here is that "The {@code timeout} specified to this method is typically a timeout value that is shorter than the operating system timeout." so that they set a lower value when appropriate.
>> 
>> Alan @AlanBateman, do you suggest we continue with this text or would any update be necessary?
>
> I think it is an unnecessary quantification, is somewhat inaccurate, and set an expectation of a developer that this is gospel or axiomatic. Indicating that  it is OS dependent should be sufficient.

> 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.

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

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


More information about the net-dev mailing list