RFR: 8293696: java/nio/channels/DatagramChannel/SelectWhenRefused.java fails with "Unexpected wakeup" [v6]

Alan Bateman alanb at openjdk.org
Thu Nov 3 17:37:34 UTC 2022


On Thu, 3 Nov 2022 15:36:58 GMT, Darragh Clarke <duke at openjdk.org> wrote:

>> Added logging to SelectWhenRefused for an intermittent failure caused by unexpected wakeups, this includes trying to receive data if there is any available to identify where it is coming from.
>> 
>> I also set the test to run in othervm mode which should reduce the chances of this failure happening in the first place.
>
> Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed buffer output

test/jdk/java/nio/channels/DatagramChannel/SelectWhenRefused.java line 112:

> 110:             }
> 111:             for (int i = 0; i < MAX_TRIES; i++) {
> 112:                 /* Test 3: not connected so ICMP port unreachable should not be received */

For readability it might be better to restore the break between Test 2 and Test 3 so that it's easier to see where Test 3 starts. The updated test is a bit hard to follow because the original comments have been moved into the loop and maybe better to just leave them where they were, as in Test 2.

test/jdk/java/nio/channels/DatagramChannel/SelectWhenRefused.java line 155:

> 153:                 buf.get(bytes);
> 154:                 String message = new String(bytes);
> 155:                 if (sa != null) {

L151-154 should be moved into the if (sa != null) { ... } as there are no bytes read when the sender is null.

test/jdk/java/nio/channels/DatagramChannel/SelectWhenRefused.java line 158:

> 156:                     System.out.format("received %s at %s from %s%n", message, datagramChannel.getLocalAddress(), sa);
> 157:                 }
> 158:                 //If any received data contains the message from sendDatagram then return false

Missing space in "//If", best to keep comments consistent where you can.

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

PR: https://git.openjdk.org/jdk/pull/10851


More information about the nio-dev mailing list