You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/08/18 08:38:42 UTC

[GitHub] [ozone] sodonnel commented on a change in pull request #2550: HDDS-5632. Intermittent failure in TestOzoneManagerBootstrap#testBootstrapTwoNewOMs

sodonnel commented on a change in pull request #2550:
URL: https://github.com/apache/ozone/pull/2550#discussion_r691027164



##########
File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java
##########
@@ -700,6 +701,9 @@ public void bootstrapOzoneManager(String omNodeId) throws Exception {
     while (true) {
       try {
         basePort = 10000 + RANDOM.nextInt(1000) * 4;
+        if (!isPortAvailable(basePort)) {

Review comment:
       Rather than trying incremental ports, can we just ask the OS for a free one, eg:
   
   private int getFreePort() {
     ServerSocket ss = null;
     try {
       ss = new ServerSocket(0);
       return ss.getLocalPort();
     } catch { 
        ...
     } finally {
       if (ss != null) {
         ss.close();
       }
   }




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org