adding rsockets support into JDK

Lu, Yingqi yingqi.lu at intel.com
Thu Nov 29 21:08:38 UTC 2018


My last email got sent with a weird format. Resending now.

Alan and Chris,

Thank you both for your quick review and feedback. Here is the version 21 of the patch: https://cr.openjdk.java.net/~ylu/8195160.21

In this version, I have addressed following items regarding to the public API:

1. Added NPE check for the 4 factory methods in jdk.net.RdmaSockets.java. 

2. @implNote says that only IPv4 is supported is dropped.

3. class description of RdmaSockets links to the updated factory methods. 

4. Modified bind() and connect() functions inside RdmaSocketImpl.java to throw IllegalArgumentException when the address to bind or connect has different protocol family as the one is specified when the socket/serversocket is created. 

5. Modified RdmaNet.java to add RdmaNet.checkAddress(SocketAddress sa, ProtocolFamily family).  UnsupportedAddressTypeException is thrown when the protocol family of "sa" is different than "family".

6. Modified bind() and connect() functions inside RdmaSocketChannelImpl.java and RdmaServerSocketChannelImpl.java to call RdmaNet.checkAddress before doing the bind and connect.

7. Updated Javadoc is available at http://cr.openjdk.java.net/~ylu/rsocket_docs/api/jdk.net/module-summary.html

Please let me know if there is anything missing above.

Regarding to the comment on
> 2) Socket has a connect method that accepts a String host name, will
>     the lookup of the host prefer IPv6 addresses when the Socket's family
>     type is INET6?
>
I want to make sure first I understand correctly. For example, my /etc/hosts file looks like
30.30.30.2              	rdma-client        rdma-client-ipv4
2400:c980:0:2::2        	rdma-client        rdma-client-ipv6

If I do
InetSocketAddress hostAddress = new InetSocketAddress("rdma-client-ipv4", 9000); 
System.out.println("address = " + hostAddress.toString()); 

or 
InetSocketAddress hostAddress = new InetSocketAddress("rdma-client-ipv6", 9000); 
System.out.println("address = " + hostAddress.toString());

hostAddress prints out as expected. 

However, if I do
InetSocketAddress hostAddress = new InetSocketAddress("rdma-client", 9000); 
System.out.println("address = " + hostAddress.toString());

hostAddress always prints out to be IPv4 address, even after I changed the order of the two addresses in /etc/hosts file. This behavior is consistent with both TCP socket and RDMA socket. Of course, in RDMA case, bind or connect will throw exception because of the un-matching protocol family. Is this an expected behavior?

Thanks,
Lucy

>-----Original Message-----
>From: nio-dev [mailto:nio-dev-bounces at openjdk.java.net] On Behalf Of Lu,
>Yingqi
>Sent: Thursday, November 29, 2018 1:02 PM
>To: Chris Hegarty <chris.hegarty at oracle.com>; Alan Bateman
><Alan.Bateman at oracle.com>
>Cc: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>; nio-
>dev at openjdk.java.net; Aundhe, Shirish <shirish.aundhe at intel.com>;
>Kaczmarek, Eric <eric.kaczmarek at intel.com>
>Subject: RE: adding rsockets support into JDK
>
>Alan and Chris,
>
>Thank you both for your quick review and feedback. Here is the version 21 of
>the patch: https://cr.openjdk.java.net/~ylu/8195160.21
>
>In this version, I have addressed following items regarding to the public API:
>
>1. Added NPE check for the 4 factory methods in jdk.net.RdmaSockets.java 2.
>@implNote says that only IPv4 is supported is dropped 3. class description of
>RdmaSockets links to the updated factory methods 4. Modified bind() and
>connect() functions inside RdmaSocketImpl.java to throw
>IllegalArgumentException when the address to bind or connect has different
>protocol family as the one is specified when the socket/serversocket is
>created 5. Modified RdmaNet.java to add
>RdmaNet.checkAddress(SocketAddress sa, ProtocolFamily family).
>UnsupportedAddressTypeException is thrown when the protocol family of
>"sa" is different than "family".
>6. Modified bind() and connect() functions inside
>RdmaSocketChannelImpl.java and RdmaServerSocketChannelImpl.java to call
>RdmaNet.checkAddress before doing the bind and connect.
>7. Updated Javadoc is available at
>http://cr.openjdk.java.net/~ylu/rsocket_docs/api/jdk.net/module-
>summary.html
>
>Please let me know if there is anything missing above.
>
>Regarding to the comment on
>> 2) Socket has a connect method that accepts a String host name, will
>>     the lookup of the host prefer IPv6 addresses when the Socket's family
>>     type is INET6?
>>
>I want to make sure first I understand correctly. For example, my /etc/hosts
>file looks like
>30.30.30.2              	rdma-client        rdma-client -ipv4
>2400:c980:0:2::2        	rdma-client        rdma-client -ipv6
>
>If I do
>InetSocketAddress hostAddress = new InetSocketAddress("rdma-client -ipv4",
>9000); System.out.println("address = " + hostAddress.toString()); or
>InetSocketAddress hostAddress = new InetSocketAddress("rdma-client -ipv6",
>9000); System.out.println("address = " + hostAddress.toString());
>
>hostAddress prints out as expected.
>
>However, if I do
>InetSocketAddress hostAddress = new InetSocketAddress("rdma-client",
>9000); System.out.println("address = " + hostAddress.toString());
>
>hostAddress always prints out to be IPv4 address, even after I changed the
>order of the two addresses in /etc/hosts file. This behavior is consistent with
>both TCP socket and RDMA socket. Of course, in RDMA case, bind or connect
>will throw exceptions because of the un-matching protocol family. Is this an
>expected behavior?
>
>Thanks,
>Lucy
>
>>-----Original Message-----
>>From: Chris Hegarty [mailto:chris.hegarty at oracle.com]
>>Sent: Thursday, November 29, 2018 6:27 AM
>>To: Alan Bateman <Alan.Bateman at oracle.com>
>>Cc: Lu, Yingqi <yingqi.lu at intel.com>; Viswanathan, Sandhya
>><sandhya.viswanathan at intel.com>; nio-dev at openjdk.java.net; Aundhe,
>>Shirish <shirish.aundhe at intel.com>; Kaczmarek, Eric
>><eric.kaczmarek at intel.com>
>>Subject: Re: adding rsockets support into JDK
>>
>>
>>> On 29 Nov 2018, at 14:22, Alan Bateman <Alan.Bateman at oracle.com>
>wrote:
>>>
>>> On 29/11/2018 13:57, Chris Hegarty wrote:
>>>> :
>>>> 1) What is the behaviour, and does it need to be specified, if a socket
>>>>    of one family type is either bound or connected to an address of a
>>>>    different family type?
>>> In the case of Socket/ServerSocket, the bind and connect methods
>>> specify
>>IAE when the SocketAddress is not supported. For
>>SocketChannel/ServerSocketChannel, UnsupportedAddressTypeException
>(a
>>specific IAE) is specified. So I think we are okay on this point.
>>
>>Right, I think this should be noted in the factory methods, so that it
>>is clear to developers.
>>
>>-Chris.


More information about the nio-dev mailing list