RFR for JDK-8031563: TEST_BUG: java/nio/channels/Selector/ChangingInterests.java failed once
Alan Bateman
Alan.Bateman at oracle.com
Mon Mar 17 10:04:36 UTC 2014
On 12/02/2014 13:34, michael cui wrote:
> Hi,
>
> Please review two suggested fixes for
>
> https://bugs.openjdk.java.net/browse/JDK-8031563
>
> Root cause: selectNow is called right after 50 milliseconds sleep in
> write1 method which may not be sufficient to make the socket channel
> readable in some situation. Since selectNow called only once and
> verification based on its result will fail if readable event wasn't
> ready at that time.
Sorry for the delay getting to this one, I've been busy with other things.
The primary purpose of the test is to exercise each of the possible
transitions and to check that the Selector doesn't spin. If we change
the test as per your webrev_v2 then it means there is no guarantee that
we exercise the transition to OP_READ + OP_WRITE as originally intended.
As it will be exercised most of the time then it might be okay but it
would clearly desirable for this transition to be testable each time.
Looking at the test now then I just wonder if perhaps the issue is that
it doesn't set TCP_NODELAY to disable the Nagle algorithm. I haven't
been able to reproduce the issue and I'm curious if you have been able
to. If you are then I'd be interested to know setting TCP_NODELAY to
true after accepting the connection will resolve the issue.
-Alan.
More information about the nio-dev
mailing list