RFR: 8335771: Improve stability of java/nio/channels/DatagramChannel tests
Daniel Fuchs
dfuchs at openjdk.org
Mon Jul 8 15:10:33 UTC 2024
On Mon, 8 Jul 2024 11:36:01 GMT, Alan Bateman <alanb 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.
OK. Note that interference can also come from other tests in other directories (like DatagramSocket tests in jdk/java/net/..) or from system processes (like syslogd on macOS which binds to an ephemeral port).
> 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.
Good point.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20050#discussion_r1668820050
PR Review Comment: https://git.openjdk.org/jdk/pull/20050#discussion_r1668820419
More information about the nio-dev
mailing list