RFR: 8333526: Restructure java/nio/channels/DatagramChannel/StressNativeSignal.java to a fail fast exception handling policy

Daniel Fuchs dfuchs at openjdk.org
Mon Sep 15 13:29:01 UTC 2025


On Mon, 15 Sep 2025 12:32:14 GMT, serhiysachkov <duke at openjdk.org> wrote:

> This task addresses the restructuring of the test to handle exception, especially during test setup, in a more immediate "fail fast" manner.

The refactoring looks good generally but why are we explicitely using ports 1122 and 19870?

test/jdk/java/nio/channels/DatagramChannel/StressNativeSignal.java line 96:

> 94: 
> 95:         public ServerSocketThread() throws IOException {
> 96:             socket = new ServerSocket(1122);

Why are we not using port 0 here? Does this test really need to run on port 1122? I would recommend using port 0, and possibly InetAddress.getLoopbackAddress() (though that's less important since we don't expect anything to connect)

test/jdk/java/nio/channels/DatagramChannel/StressNativeSignal.java line 142:

> 140:             channel = DatagramChannel.open();
> 141:             channel.setOption(StandardSocketOptions.SO_RCVBUF, 6553600);
> 142:             channel.bind(new InetSocketAddress(19870));

Unless using a specific port number is required to trigger the condition being tested, we should bind to port 0 here  (and possibly use the loopback too)

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

PR Review: https://git.openjdk.org/jdk/pull/27294#pullrequestreview-3224582839
PR Review Comment: https://git.openjdk.org/jdk/pull/27294#discussion_r2348984657
PR Review Comment: https://git.openjdk.org/jdk/pull/27294#discussion_r2348988527


More information about the nio-dev mailing list