Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-18583

Fix shutting down IsolatedJmx

    XMLWordPrintableJSON

Details

    • Code
    • Low
    • Low Hanging Fruit
    • Adhoc Test
    • All
    • None

    Description

      public class MyTest extends TestBaseImpl
      {
          @Test
          public void test() throws Throwable
          {
              try (Cluster cluster = Cluster.build(2).withConfig(c -> c.with(Feature.values())).start())
              {
                  ClusterUtils.stopUnchecked(cluster.get(2));
                  System.out.println(cluster.get(1).nodetoolResult("status").getStderr());
              }
          }
      }  

      This will fail on this:

      java.net.BindException: Address already in use (Bind failed)
      	at java.net.PlainSocketImpl.socketBind(Native Method)
      	at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
      	at java.net.ServerSocket.bind(ServerSocket.java:390)
      	at java.net.ServerSocket.<init>(ServerSocket.java:252)
      	at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
      	at org.apache.cassandra.distributed.impl.CollectingRMIServerSocketFac
      

      The problem is that IsolatedJMX clears whole map of TCPTransports in clearMapField as part of the stopJmx method. This results in JMX internals thinking the socket is not there so it tries to create it but it fails to do so because it is technically still bound.

      The fix is consisting of cleaning just the bits belonging to that specific IsolatedJMX instance.
      The investigation of the issue done by myself, the actual fix by drohrer. Found while working on CASSANDRA-18572.

      Attachments

        Issue Links

          Activity

            People

              smiklosovic Stefan Miklosovic
              smiklosovic Stefan Miklosovic
              Stefan Miklosovic
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: