RFR: 8319757: java/nio/channels/DatagramChannel/InterruptibleOrNot.java failed: wrong exception thrown [v2]

Brian Burkhalter bpb at openjdk.org
Fri Jan 5 16:39:24 UTC 2024


On Thu, 4 Jan 2024 12:54:34 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> InterruptibleOrNot.testInterruptBeforeInterruptibleReceive has failed a few times. It calls DatagramChannel.receive with the interrupt status set and expects ClosedByInterruptException to be thrown. The shared part of the test is also used for the non-interruptible scenario which needs a delayed close to ensure the thread calling receive wakes up. The 2s delay is not sufficient and thus it's possible for the async close to beat the detection of the interrupt status. This leads to AsynchronousCloseException instead of the expected ClosedByInterruptException.
>> 
>> The test is re-worked to split the interruptible and non-interruptible tests. The test is also changed to drop the delayed interrupt/close and instead use a thread to poll under the target thread is in DatagramChannel.receive. The overall test is simpler. I changed it to be a JUnit test, that part is only a few lines of changes.
>
> Alan Bateman has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix comment in testInterruptDuringUninterruptibleReceive

Looks good insofar as I know this area.

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

Marked as reviewed by bpb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17251#pullrequestreview-1806364790


More information about the nio-dev mailing list