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

Mark Sheppard msheppar at openjdk.org
Thu Oct 27 18:55:37 UTC 2022


On Thu, 27 Oct 2022 18:24:05 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> test/jdk/java/nio/channels/DatagramChannel/SelectWhenRefused.java line 65:
>> 
>>> 63:                     ignoreStrayWakeup = checkUnexpectedWakeup(dc, sel.selectedKeys());
>>> 64:                     sel.selectedKeys().clear();
>>> 65:                     if (ignoreStrayWakeup) {
>> 
>> scenario 1 and 3 treat the received message differently to that of scenario 2 -- should they be handled the same ?
>
> I don't think so - scenario 2 is the one that expect the PortUnreachableException - so the wakeup is expected there and the read is expected to throw PortUnreadableException. The other two scenario are expected to timeout of the select with n == 0;

I mean the actual testing of the received message -- scenario performs the read, and expects an Exception but if it gets a message,  which like the other scenarios it shouldn't, then the test of that message should be the same across all 3  scenarios ?
scenario 1 and 3 test if they receive what has been sent then retry, while scenario 2 will throw a RuntimeException if it receives what it has sent. This seems inconsistent.

Maybe change the send message to be completely unique to this test, there maybe other DatagramSocket or Channel tests that have message containing "Greetings"

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

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


More information about the nio-dev mailing list