On Sat, 19 Sep 2026 08:39:11 GMT, Jaikiran Pai <[email protected]> wrote:

>> Can I please get a review of this change which addresses the issue noted in 
>> https://bugs.openjdk.org/browse/JDK-8392732?
>> 
>> On macos 27, it appears that the limit imposed by the OS for the `SO_LINGER` 
>> socket option has changed. It now fails with a `EDOM` (Numerical argument 
>> out of domain) error for values greater than 32767. 
>> 
>> The commit in this PR updates the JDK's code to limit the user provided 
>> value for linger to 32767. If the provided value is greater than 32767, then 
>> `SO_LINGER` will be set to 32767. The `Socket.setSoLinger(...)` already 
>> states that:
>> 
>>> The maximum timeout value is platform specific.  
>> 
>> so this change doesn't require additional specification changes. 
>> Furthermore, the change applies this new limit to all versions of macos 
>> since the 32767 value is large enough for practical uses of lingering on 
>> close of a socket.
>> 
>> tier testing with this change has completed without any issues (on all 
>> platforms and on macos older versions as well as macos 27).
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Jaikiran Pai has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   add 8392732 to @bug of the test

test/jdk/java/net/Socket/SetSoLinger.java line 54:

> 52:         int actual;
> 53:         try (ServerSocket ss = new ServerSocket()) {
> 54:             InetSocketAddress socketAddress = new 
> InetSocketAddress(InetAddress.getLocalHost(), 0);

Use getLoopbackAddress instead?

test/jdk/java/net/Socket/SetSoLinger.java line 59:

> 57:             try (Socket s = new Socket(ss.getInetAddress(), 
> ss.getLocalPort());
> 58:                  // accept the connection
> 59:                  Socket accepted = ss.accept()) {

The "accept the connection" comment ends up between two conditions so hard to 
see where the end of the resource is, so I think drop that line.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32961#discussion_r4053317201
PR Review Comment: https://git.openjdk.org/jdk/pull/32961#discussion_r4053324353

Reply via email to