Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-8333

HotRod client test suite fails with java.net.BindException when run through IKVM

    XMLWordPrintable

Details

    Description

      The Java test suite being run through IKVM throws a BindException. The tests are run through IKVM in the .NET native client. Upgrading the ISPN dependency in the .NET client to 9.1.1 introduces this problem.

      The test suite is first trying to find a free port but this ends up with the following exception (when I print the stack trace), and it falls back to returning a predefined port 15232:

      java.net.SocketException: socket closed
      3:      at ikvm.internal.JNI.JNU_ThrowByName(JNI.java:53)
      3:      at java.net.TwoStacksPlainSocketImpl_c.socketListen(TwoStacksPlainSocketImpl_c.java:586)
      3:      at java.net.TwoStacksPlainSocketImpl.socketListen(TwoStacksPlainSocketImpl.java:235)
      3:      at java.net.PlainSocketImpl.socketListen(PlainSocketImpl.java:329)
      3:      at java.net.AbstractPlainSocketImpl.listen(AbstractPlainSocketImpl.java:395)
      3:      at java.net.ServerSocket.bind(ServerSocket.java:377)
      3:      at java.net.ServerSocket.<init>(ServerSocket.java:237)
      3:      at java.net.ServerSocket.<init>(ServerSocket.java:129)
      3:      at org.infinispan.server.core.test.ServerTestingUtil.findFreePort(ServerTestingUtil.java:47)
      3:      at org.infinispan.server.core.test.ServerTestingUtil.startProtocolServer(ServerTestingUtil.java:73)
      3:      at org.infinispan.client.hotrod.test.HotRodClientTestingUtil.startHotRodServer(HotRodClientTestingUtil.java:51)
      3:      at org.infinispan.client.hotrod.test.HotRodClientTestingUtil.startHotRodServer(HotRodClientTestingUtil.java:47)
      3:      at org.infinispan.client.hotrod.test.HotRodClientTestingUtil.startHotRodServer(HotRodClientTestingUtil.java:55)
      3:      at org.infinispan.client.hotrod.StringSerializerHotRodTest.createCacheManager(StringSerializerHotRodTest.java:74)
      3:      at org.infinispan.test.SingleCacheManagerTest.setup(SingleCacheManagerTest.java:31)
      3:      at org.infinispan.client.hotrod.StringSerializerHotRodTest.setUp(StringSerializerHotRodTest.java:139)
      3:      at java.lang.reflect.Method.invoke(Method.java:486)
      3:      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:79)
      3:      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
      3:      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
      3:      at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
      3:      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      3:      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1228)
      3:      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      3:      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      3:      at org.testng.TestRunner.privateRun(TestRunner.java:766)
      

      Subsequently the test suite is assigning the same port to multiple tests and it results in the following exception:

      java.lang.AssertionError: java.net.BindException: Only one usage of each socket address (protocol/network address/port) is normally permitted
      2:      at org.infinispan.server.core.test.ServerTestingUtil.startProtocolServer(ServerTestingUtil.java:79)
      2:      at org.infinispan.client.hotrod.test.HotRodClientTestingUtil.startHotRodServer(HotRodClientTestingUtil.java:51)
      2:      at org.infinispan.client.hotrod.test.HotRodClientTestingUtil.startHotRodServer(HotRodClientTestingUtil.java:47)
      2:      at org.infinispan.client.hotrod.test.HotRodClientTestingUtil.startHotRodServer(HotRodClientTestingUtil.java:55)
      2:      at org.infinispan.client.hotrod.CrossLanguageHotRodTest.createCacheManager(CrossLanguageHotRodTest.java:124)
      2:      at org.infinispan.test.SingleCacheManagerTest.setup(SingleCacheManagerTest.java:31)
      2:      at org.infinispan.client.hotrod.CrossLanguageHotRodTest.setUp(CrossLanguageHotRodTest.java:186)
      2:      at org.infinispan.client.hotrod.CrossLanguageHotRodTest.main(CrossLanguageHotRodTest.java:642)
      2: Caused by: java.net.BindException: Only one usage of each socket address (protocol/network address/port) is normally permitted
      2:      at java.net.SocketUtil.convertSocketExceptionToIOException(SocketUtil.java:58)
      2:      at IKVM.NativeCode.sun.nio.ch.Net.bind0(Unknown Source)
      2:      at sun.nio.ch.Net.bind(Net.java:438)
      2:      at sun.nio.ch.Net.bind(Net.java:430)
      2:      at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
      2:      at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128)
      2:      at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554)
      2:      at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1259)
      2:      at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501)
      2:      at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486)
      2:      at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:980)
      2:      at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250)
      2:      at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:365)
      2:      at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
      2:      at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405)
      2:      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
      2:      at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:859)
      2:      at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
      2:      at java.lang.Thread.run(Thread.java:955)
      2: ... Removed 20 stack frames
      

      Attachments

        Activity

          People

            mgencur Martin Gencur
            mgencur Martin Gencur
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: