RFR: 8293696: java/nio/channels/DatagramChannel/SelectWhenRefused.java fails with "Unexpected wakeup" [v10]
Daniel Fuchs
dfuchs at openjdk.org
Wed Nov 9 15:06:37 UTC 2022
On Tue, 8 Nov 2022 19:53:41 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:
> Using the setup strategy would be in keeping with junit idioms, but it is debatable if it is worth it here (i'm not advocating it).
Agreed. I don't think we should do this.
> If the second connected scenario does not raise a PUE, then refuser port re-allocation could be a contributing factor, that is, the delivery of a datagram to an extant UDP end point.
Good observation. Maybe we should copy:
// BindException will be thrown if another service is using
// our expected refuser port, cannot run just exit.
DatagramChannel.open().bind(refuser).close();
just before line 166.
If we really wanted to split into three tests then each test should probably create its own refuser etc...
That would mean cloning the test() method into 3 new method where:
1. the first one would return after the first loop.
2. the second one would remove the first loop and return after the second loop.
3. the third test would carry out the actions in the second loop without without performing any checks and without looping, and then would perform the third loop.
All in all I believe it's simpler to keep the single one test method that we have, even if it tests 3 scenarios - because at least we will be checking our assumption and print diagnosis information after each step along the way. It will be easier to reason about if it fails, I think.
-------------
PR: https://git.openjdk.org/jdk/pull/10851
More information about the nio-dev
mailing list