RFR for JDK-8027212: java/nio/channels/Selector/SelectAfterRead.java fails intermittently

Eric Wang yiming.wang at oracle.com
Mon Nov 25 01:15:26 PST 2013


Hi Alan & All,

I finally finished the internal discussion about the fix. Please review 
the webrev below, I also make some cleanup jobs, so other 3 tests which 
uses ByteServer are changed.
http://cr.openjdk.java.net/~ewang/JDK-8027212/webrev.00/ 
<http://cr.openjdk.java.net/%7Eewang/JDK-8027212/webrev.00/>

Thanks,
Eric
On 2013/11/19 18:36, Alan Bateman wrote:
> On 19/11/2013 06:25, Eric Wang wrote:
>> Hi everyone,
>>
>> I'm working on the bug 
>> https://bugs.openjdk.java.net/browse/JDK-8027212. after research, it 
>> is a test failure.
>> Root Cause:
>> The test is based on bad assumption that the ByteServer thread has 
>> finished to write bytes to client before the client SelectAfterRead 
>> calls selector.select(TIMEOUT)(TIMEOUT=1000).
>>
>> Suggested Fix:
>> Use CountDownLatch to sync up server and client, The fix looks like 
>> below, Please let me know if you have any comments or suggestions.
> Thanks Eric, I think your analysis that the 1000ms is insufficient is 
> right (unfortunately some of the tests from the JDK 1.4 era had issues 
> like this).
>
> We can fix this in several ways. Using a CountDownLatch is okay here 
> but it might be simpler for await to do serverthread.join() because 
> the server thread ends when it has written the bytes.
>
> What you would think about doing a few other clean-ups to ByteServer? 
> For example the start method shouldn't do a System.exit if it gets an 
> exception Also several of the fields can be final.
>
> -Alan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20131125/9d9fa476/attachment.html 


More information about the nio-dev mailing list