RFR: 8335771: Improve stability of java/nio/channels/DatagramChannel tests
Alan Bateman
alanb at openjdk.org
Mon Jul 8 11:40:33 UTC 2024
On Fri, 5 Jul 2024 10:50:56 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
> Several `java/nio/channels/DatagramChannel` tests fail intermittently. Though it seems difficult to fix all intermittent failures due to the nature of what some of these attempt to test, the stability can still be improved.
>
> The most common source of intermittent failures are:
>
> - not receiving a datagram due to port conflict or interference of concurrent running tests
> - failure to disconnect due to interference of concurrent running tests
> - failure due to reception of unexpected stray datagrams
>
> Avoiding to bind on the wildcard address, filtering unexpected datagram, and some retrying can aleviate some of the issues and greatly reduce the frequency of intermittent failures.
test/jdk/java/nio/channels/DatagramChannel/NotBound.java line 29:
> 27: * the channel's socket to be bound to a local address. This test may fail
> 28: * intermittently on macOS if other datagram channel tests are running
> 29: * concurrently on the same host.
I don't think we should add this comment. Instead, if there is interference possible on the same host then we should create a TEST.properties in this directory with `exclusiveAccess.dirs=.` so that the tests don't run concurrently.
test/jdk/java/nio/channels/DatagramChannel/SelectWhenRefused.java line 65:
> 63: if (((InetSocketAddress)dc.getLocalAddress()).getPort() == port) {
> 64: if (i < MAX_TRIES - 1) {
> 65: System.out.format("Refuser port has been reused by dc: %s, retrying...%n",
I think this test is a JUnit test, in which case trace messages should probably go to System.err so that they are inlined with other test output rather than in a separate section of the .jtr file.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20050#discussion_r1668467429
PR Review Comment: https://git.openjdk.org/jdk/pull/20050#discussion_r1668469197
More information about the nio-dev
mailing list