RFR: 8332535: Mark java/nio/channels/DatagramChannel/Loopback.java as intermittent [v3]
Daniel Fuchs
dfuchs at openjdk.org
Wed Jun 26 11:46:10 UTC 2024
On Wed, 26 Jun 2024 02:54:36 GMT, SendaoYan <syan at openjdk.org> wrote:
>> Hi all,
>> The test `test/jdk/java/nio/channels/DatagramChannel/Loopback.java` intermittent fail, the failure probability is about 2/1000. This PR mark this test intermittent, and print more messages to investigate the intermittent failure. Only change the testcase, no risk.
>
> SendaoYan has updated the pull request incrementally with two additional commits since the last revision:
>
> - Merge branch 'jbs8332535' of github.com:sendaoYan/jdk-ysd into jbs8332535
> - add some entropy to the message content and discard any message that we receive whose payload doesn't match what we expect
test/jdk/java/nio/channels/DatagramChannel/Loopback.java line 166:
> 164: dst.clear();
> 165: continue;
> 166: }
This is not the correct way to compare two ByteBuffers. ByteBuffer::toString only output things like position, limit, etc.. I suggest using `ByteBuffer::mismatch` instead.
You will have to `flip` src after line 146 though, since all bytes in src will have been read at that point.
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/ByteBuffer.html#mismatch(java.nio.ByteBuffer)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19314#discussion_r1654657270
More information about the nio-dev
mailing list