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

Daniel Fuchs dfuchs at openjdk.org
Wed Nov 2 12:23:03 UTC 2022


On Wed, 2 Nov 2022 12:12:41 GMT, Darragh Clarke <duke at openjdk.org> wrote:

>> I had a suspicion that maybe the selector could be woken up if the key became invalid - even though since this is a datagram channel and we're not closing it, I don't see how it could happen. If the key is invalid, there would be nothing to read. In addition, `n` is not supposed to be `> 0`, therefore something unexpected is going on. It seems useful to double check our assumptions: n > 0 because the key is active for reading. I'd like to check that. Hence the idea that passing the key was important. And you only want to attempt reading if the key is active for reading. Otherwise we'd get some other kind of exception and we would still not be the wiser. Good point about calling `key::channel` though!
>
> So remove all the key prints and just attempt dc.receive and try to show its result?

Please no. Pass the key (or selected key set) but not the dc, and obtain the dc by calling key::channel.

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

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


More information about the nio-dev mailing list