RFR: 8287580: (se) CancelledKeyException during channel registration [v2]

Brian Burkhalter bpb at openjdk.java.net
Thu Jun 2 18:28:21 UTC 2022


On Thu, 2 Jun 2022 04:55:35 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8287580: Add catch to AbstractSelectableChannel, remove remove() from SelectorImpl, open only one SocketChannel in test
>
> test/jdk/java/nio/channels/Selector/KeyCancelled.java line 67:
> 
>> 65:                     c.register(s, SelectionKey.OP_READ);
>> 66:                     // c.isRegistered() is false here after the exceptional case
>> 67:                 }
> 
> This tries to create 10k SocketChannels. I would be concerned with the robustness of this test. I suspect it should be possible to create the conditions for the bug with just one socket channel where the registration key is flushed from the Selector in the loop, the next registration will create a new key that can be cancelled asynchronously by the other thread.

Commit 925336449bfda90791b7e289d0008da4a9bc87a6 changes the test to use a single `SocketChannel`.

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

PR: https://git.openjdk.java.net/jdk/pull/8978


More information about the nio-dev mailing list