8200256: java/nio/channels/AsynchronousChannelGroup/Basic.java fails intermittently
Chris Hegarty
chris.hegarty at oracle.com
Tue Mar 27 07:18:00 UTC 2018
> On 26 Mar 2018, at 19:39, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> This test has been failing recently on macOS and Linux with "Group should have terminated" when testing the shutdown of a channel group. Chris and others working on the HTTP client API have had several sightings during their testing.
>
> The issue turns out to be a regression in channel group shutdown implementation. When woken up, a thread should read a single byte from the wakeup pipe but recent changes means it may consume more bytes, thus leaving other threads waiting for an event. Easy fix to change this code back to reading one byte. With this fix, the test runs 1M times for me without an issue. Without the fix then it usually fails in 50000 runs or less.
>
> The webrev with the change is here:
> http://cr.openjdk.java.net/~alanb/8200256/webrev/index.html
I think this looks fine ( at least that is what the code used to do before 8199791 ). The ( now safe ) racy interaction between wakeupCount and the use of a “single” byte, during shutdown, is a little subtle, maybe worth a comment for future maintainers.
-Chris.
More information about the nio-dev
mailing list