RFR: 8259628: jdk/net/ExtendedSocketOption/AsynchronousSocketChannelNAPITest.java fails intermittently [v4]
Daniel Fuchs
dfuchs at openjdk.java.net
Fri Jan 22 14:44:47 UTC 2021
On Fri, 22 Jan 2021 12:32:09 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:
>> Hi,
>>
>> Could someone please review my fix for JDK-8259628: '`jdk/net/ExtendedSocketOption/AsynchronousSocketChannelNAPITest.java` fails intermittently' ?
>>
>> `AsynchronousSocketChannelNAPITest` is failing intermittently on Linux due to a race condition caused by not correctly waiting for the result of an asynchronous operation. This fix rectifies this issue and adds additional checks to ensure correct result is received.
>>
>> Kind regards,
>> Patrick
>
> Patrick Concannon has updated the pull request incrementally with one additional commit since the last revision:
>
> 8259628: Removed buffer check
You could still do some checking if you wanted.
If you know that you have written `nsent` bytes, and that you later read `nread` bytes, then you could assert the following:
1. nread <= nsent
2. writeBuffer.mismatch(readBuffer) == (nread == nsent ? -1 : nread)
-------------
Changes requested by dfuchs (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2162
More information about the net-dev
mailing list