JDK 9 RFR of JDK-8156002: java/nio/channels/SocketChannel/AdaptSocket.java Fails in Mesos on OSX

Hamlin Li huaming.li at oracle.com
Fri May 6 12:14:14 UTC 2016


On 2016/5/6 15:45, Daniel Fuchs wrote:
> On 5/6/16 8:58 AM, Hamlin Li wrote:
>> Please review the patch for
>> java/nio/channels/SocketChannel/AdaptSocket.java Fails in Mesos on OSX.
>>
>> Root Cause: it's kind of race condition due to linger time and timeout
>> time. Even though timeout(10ms) is far less than linger time(100ms), but
>> in some condition the linger time is still not long enough.
>> Suggested Fix: create a NoResponseServer which will accept connection
>> but never response to any input.
>>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8156002
>> webrev: http://cr.openjdk.java.net/~mli/8156002/webrev.01/
>
> Hi Hamlin,
>
> The idea is very good, but I wonder about the implementation.
> calling super(Long.MAX_VALUE) will make the NoResponseServer
> wait forever in the accept loop line 223 - while I think that
> for the spirit of this test we want the accept loop to
> proceed normally, but linger instead in the connection
> thread, line 372.
Hi Daniel,

Thanks for reviewing. Please let me clarify.
Yes, NoResponseServer will wait forever in the accept loop line 223 (in 
TestServers.java). But,
  1. As we only need only one connection, so it does not matter, 
NoResponseServer will accept one connection at line 222 (in 
TestServers.java) and not response to any input from the client connection.
  2. Even if there are 2 or more connections coming, NoResponseServer 
will still work as expected. In java code level as you mentioned it will 
wait forever in the accept loop at line 223 (in TestServers.java), but 
real TCP accept operation will be finished by TCP stack once the 
ServerSocket object is constructed, so real TCP accept operation will 
not be blocked at line 223 (in TestServers.java). So although 
NoResponseServer will wait forever at line 223 (in TestServers.java), it 
can accept multiple connections.

The test pass JPRT: 
http://scaaa637.us.oracle.com/archive/2016/05/2016-05-06-070151.oracle.dev/. 

It works well even if line 175 (in AdaptSocket.java) is looped for 100 
times.

Thank you
-Hamlin
>
> Or am I mistaken?
>
> best regards,
>
> -- daniel
>
>



More information about the nio-dev mailing list