adding rsockets support into JDK

Chris Hegarty chris.hegarty at oracle.com
Wed Nov 21 12:30:31 UTC 2018


Lucy,

On 20/11/18 12:54, Chris Hegarty wrote:
> ...
>> On 20 Nov 2018, at 04:06, Lu, Yingqi <yingqi.lu at intel.com> wrote:
>>
>> Hi Chris,
>>
>> Thank you for your quick feedback. I have uploaded version 18 of the patch at http://cr.openjdk.java.net/~ylu/8195160.18/

Some further review comments:

1) Rsocket.c uses a constant value native library name, "librdmacm.so",
    that will be used in `dlopen`. Should this not specify the major
    version, e.g. "librdmacm.so.1". Otherwise, who knows what version
    the implementation is compatible with.

2) On Linux without librdmacm installed, I get the following incorrect
    exception when opening a new RDMA socket.

   Exception in thread "main" java.lang.ExceptionInInitializerError
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:325)
	at 
jdk.net/jdk.net.RdmaSocketOptions$PlatformRdmaSocketOptions.newInstance(RdmaSocketOptions.java:241)
	at 
jdk.net/jdk.net.RdmaSocketOptions$PlatformRdmaSocketOptions.create(RdmaSocketOptions.java:256)
	at 
jdk.net/jdk.net.RdmaSocketOptions$PlatformRdmaSocketOptions.<clinit>(RdmaSocketOptions.java:260)
	at jdk.net/jdk.net.RdmaSocketOptions.<clinit>(RdmaSocketOptions.java:118)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:325)
	at 
java.base/sun.net.ext.RdmaSocketOptions.<clinit>(RdmaSocketOptions.java:80)
	at 
jdk.net/jdk.internal.net.rdma.RdmaSocketImpl.<clinit>(RdmaSocketImpl.java:86)
	at 
jdk.net/jdk.internal.net.rdma.RdmaSocketProvider.openSocket(RdmaSocketProvider.java:137)
	at jdk.net/jdk.net.RdmaSockets.openSocket(RdmaSockets.java:86)
	at RdmaTest.main(RdmaTest.java:6)
   Caused by: java.lang.UnsupportedOperationException: librdmacm.so: 
cannot open shared object file: No such file or directory
	at jdk.net/jdk.net.LinuxRdmaSocketOptions.init(Native Method)
	at 
jdk.net/jdk.net.LinuxRdmaSocketOptions.<clinit>(LinuxRdmaSocketOptions.java:51)
	... 13 more

    If the code locating librdmacm continues to throw UOE, then the
    calling code should catch it and propagate it as appropriate.

    On Linux without librdmacm installed the factory methods should
    throw UOE rather than ExceptionInInitializerError.

3) On Linux with librdmacm installed, I can create the Socket but when
    operations are invoked on it I get:
     "java.net.SocketException: No such device"

     , which I think it as expected. Good. < no change needed >

4) In light of 2 above. I would like to make some changes to the tests
    so that they assert that the factory methods throw UOE if the
    platform does not have RDMA support installed.

    Suggest: amending `RsocketTest::isRsocketAvailable` to call a new
    method if unavailable, similar to:

     checkThrowsUOE(jdk.net.RdmaSockets::openSocket);
     checkThrowsUOE(jdk.net.RdmaSockets::openServerSocket);
     checkThrowsUOE(jdk.net.RdmaSockets::openSocketChannel);
     checkThrowsUOE(jdk.net.RdmaSockets::openServerSocketChannel);
     checkThrowsUOE(jdk.net.RdmaSockets::openSelector);

     static void checkThrowsUOE(ThrowingRunnable runnable) throws 
IOException {
         try {
             runnable.run();
             throw new RuntimeException("Unexpected creation");
         } catch (UnsupportedOperationException expected) { }
     }
     interface ThrowingRunnable { void run() throws IOException; }

-Chris.


More information about the nio-dev mailing list