RFR for JDK-8031563: TEST_BUG: java/nio/channels/Selector/ChangingInterests.java failed once
michael cui
michael.cui at oracle.com
Tue Mar 25 07:56:39 UTC 2014
Hi Alan,
Thank you very much for review, please see my comments inline :
On 03/17/2014 06:04 PM, Alan Bateman wrote:
> On 12/02/2014 13:34, michael cui wrote:
> 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.
My understanding is the transition combination is formed by two
for-loops and there is no change for that.
The change I made in testChange method will try to call
selector.selectNow() more than once if and only if
(transition is OP_READ + OP_WRITE) and (either read event or write event
didn't arrive at moment of calling selectNow ).
Anyway, this code change won't fix the issue. The fix you suggested is
the right solution.
>
> 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.
That's should be the root cause and should fix the issue.
I updated code based on your suggestion. Please review the fix at
http://cr.openjdk.java.net/~ewang/michael/JDK-8031563/webrev.00/
<http://cr.openjdk.java.net/%7Eewang/michael/JDK-8031563/webrev.00/>
Test had been done on Window, Mac, Linux and Solaris. No failure was
found during 2000 runs on each platform.
>
> -Alan.
Thanks,
Michael Cui
More information about the nio-dev
mailing list