RFR: 8293696: java/nio/channels/DatagramChannel/SelectWhenRefused.java fails with "Unexpected wakeup"
Alan Bateman
alanb at openjdk.org
Tue Oct 25 13:06:10 UTC 2022
On Tue, 25 Oct 2022 12:35:15 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.
test/jdk/java/nio/channels/DatagramChannel/SelectWhenRefused.java line 114:
> 112: if (!key.isValid() || !key.isReadable()) {
> 113: System.out.println("Invalid or unreadable key: " + key);
> 114: return;
The loop over the selection keys and checking if valid or readable doesn't make sense here. Maybe that can be just removed. If you really want to print out the selection key then save it at L52 so that you have the SelectionKey to print.
test/jdk/java/nio/channels/DatagramChannel/SelectWhenRefused.java line 119:
> 117: System.out.println("Attempting to read datagram from key: " + key);
> 118: ByteBuffer buf = ByteBuffer.allocate(100);
> 119: SocketAddress sa = dc.receive(buf);
The datagram channel is configured non-blocking and there may not be a datagram to receive, therefore sa may be null and has to be checked here.
-------------
PR: https://git.openjdk.org/jdk/pull/10851
More information about the nio-dev
mailing list