Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-14784

Port conflict is not resolved in HBaseTestingUtility.randomFreePort()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.1.2
    • 1.2.0, 1.3.0, 2.0.0
    • test
    • None
    • Reviewed

    Description

      If takenRandomPorts.contains(port) == true, it means port conflict, so randomFreePort() should rerun the loop. But continue statement leads to exit the loop, because port != 0.

      hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
      public static int randomFreePort() {
        int port = 0; 
        do { 
          port = randomPort();
          if (takenRandomPorts.contains(port)) {
            continue;
          }    
          takenRandomPorts.add(port);
      
          ...
      
        } while (port == 0);
        return port;
      }
      

      Attachments

        1. HBASE-14784_Test.patch
          7 kB
          Youngjoon Kim
        2. HBASE-14784.patch
          1.0 kB
          Youngjoon Kim

        Activity

          People

            y0un5 Youngjoon Kim
            y0un5 Youngjoon Kim
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: