Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12474

MiniKMS should use random ports for Jetty server by default

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      In MiniKMS, there is potential data race when create jetty server in createJettyServer. It looks like the code searches for a free port and then starts jetty, but maybe there's enough of a race condition between port location and jetty.start to cause intermittent failures.

            ServerSocket ss = new ServerSocket((inPort < 0) ? 0 : inPort, 50, localhost);
            int port = ss.getLocalPort();
            Server server = new Server(0);
            if (!ssl) {
              server.getConnectors()[0].setHost(host);
              server.getConnectors()[0].setPort(port);
            } else {
              ...
              c.setPort(port);
      

      We've seen test failures saying java.net.BindException: Address already in use, e.g. https://builds.apache.org/job/PreCommit-HDFS-Build/12942/testReport/

      As in HADOOP-12417, we should always bind port 0 which gives us an ephemeral port, instead of searching a free port before starting jetty.

      1. HADOOP-12474.001.patch
        2 kB
        Mingliang Liu
      2. HADOOP-12474.000.patch
        2 kB
        Mingliang Liu

        Activity

        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Hdfs-trunk #2429 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2429/)
        HADOOP-12474. MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0)

        • hadoop-common-project/hadoop-common/CHANGES.txt
        • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #2429 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2429/ ) HADOOP-12474 . MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #491 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/491/)
        HADOOP-12474. MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0)

        • hadoop-common-project/hadoop-common/CHANGES.txt
        • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #491 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/491/ ) HADOOP-12474 . MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #535 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/535/)
        HADOOP-12474. MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0)

        • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #535 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/535/ ) HADOOP-12474 . MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0) hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk #1259 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1259/)
        HADOOP-12474. MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0)

        • hadoop-common-project/hadoop-common/CHANGES.txt
        • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #1259 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1259/ ) HADOOP-12474 . MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Mapreduce-trunk #2470 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2470/)
        HADOOP-12474. MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0)

        • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        • hadoop-common-project/hadoop-common/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk #2470 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2470/ ) HADOOP-12474 . MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0) hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java hadoop-common-project/hadoop-common/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #523 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/523/)
        HADOOP-12474. MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0)

        • hadoop-common-project/hadoop-common/CHANGES.txt
        • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #523 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/523/ ) HADOOP-12474 . MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Hide
        liuml07 Mingliang Liu added a comment -

        Thank you Haohui Mai for your review and commit.

        Show
        liuml07 Mingliang Liu added a comment - Thank you Haohui Mai for your review and commit.
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-trunk-Commit #8623 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8623/)
        HADOOP-12474. MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0)

        • hadoop-common-project/hadoop-common/CHANGES.txt
        • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #8623 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8623/ ) HADOOP-12474 . MiniKMS should use random ports for Jetty server by (wheat9: rev 7f00fcac77afa7b8ddebb12f6e6266b030a96bd0) hadoop-common-project/hadoop-common/CHANGES.txt hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/MiniKMS.java
        Hide
        wheat9 Haohui Mai added a comment -

        I've committed the patch to trunk and branch-2. Thanks Mingliang Liu for the contribution.

        Show
        wheat9 Haohui Mai added a comment - I've committed the patch to trunk and branch-2. Thanks Mingliang Liu for the contribution.
        Hide
        wheat9 Haohui Mai added a comment -

        +1. I'll commit it shortly.

        Show
        wheat9 Haohui Mai added a comment - +1. I'll commit it shortly.
        Hide
        hadoopqa Hadoop QA added a comment -



        +1 overall



        Vote Subsystem Runtime Comment
        0 pre-patch 7m 6s Pre-patch trunk compilation is healthy.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 tests included 0m 0s The patch appears to include 1 new or modified test files.
        +1 javac 8m 57s There were no new javac warning messages.
        +1 release audit 0m 24s The applied patch does not increase the total number of release audit warnings.
        +1 checkstyle 0m 25s There were no new checkstyle issues.
        +1 whitespace 0m 0s The patch has no lines that end in whitespace.
        +1 install 1m 39s mvn install still works.
        +1 eclipse:eclipse 0m 39s The patch built with eclipse:eclipse.
        +1 findbugs 0m 48s The patch does not introduce any new Findbugs (version 3.0.0) warnings.
        +1 common tests 1m 42s Tests passed in hadoop-kms.
            21m 45s  



        Subsystem Report/Notes
        Patch URL http://issues.apache.org/jira/secure/attachment/12766383/HADOOP-12474.001.patch
        Optional Tests javac unit findbugs checkstyle
        git revision trunk / 6716f15
        hadoop-kms test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7803/artifact/patchprocess/testrun_hadoop-kms.txt
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7803/testReport/
        Java 1.7.0_55
        uname Linux asf901.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7803/console

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 pre-patch 7m 6s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. +1 tests included 0m 0s The patch appears to include 1 new or modified test files. +1 javac 8m 57s There were no new javac warning messages. +1 release audit 0m 24s The applied patch does not increase the total number of release audit warnings. +1 checkstyle 0m 25s There were no new checkstyle issues. +1 whitespace 0m 0s The patch has no lines that end in whitespace. +1 install 1m 39s mvn install still works. +1 eclipse:eclipse 0m 39s The patch built with eclipse:eclipse. +1 findbugs 0m 48s The patch does not introduce any new Findbugs (version 3.0.0) warnings. +1 common tests 1m 42s Tests passed in hadoop-kms.     21m 45s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12766383/HADOOP-12474.001.patch Optional Tests javac unit findbugs checkstyle git revision trunk / 6716f15 hadoop-kms test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7803/artifact/patchprocess/testrun_hadoop-kms.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7803/testReport/ Java 1.7.0_55 uname Linux asf901.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7803/console This message was automatically generated.
        Hide
        liuml07 Mingliang Liu added a comment -

        Thank you Haohui Mai for you review. It makes perfect sense to me that the class field will be initialized with default value (which is 0). The v1 patch address this.

        Show
        liuml07 Mingliang Liu added a comment - Thank you Haohui Mai for you review. It makes perfect sense to me that the class field will be initialized with default value (which is 0). The v1 patch address this.
        Hide
        wheat9 Haohui Mai added a comment -

        Thanks Mingliang for picking this up. The patch looks good to me. One nit:

        -    private int inPort = -1;
        +    private int inPort = 0;
        

        It can be simplified as private int inPort;.

        Show
        wheat9 Haohui Mai added a comment - Thanks Mingliang for picking this up. The patch looks good to me. One nit: - private int inPort = -1; + private int inPort = 0; It can be simplified as private int inPort; .
        Hide
        hadoopqa Hadoop QA added a comment -



        +1 overall



        Vote Subsystem Runtime Comment
        0 pre-patch 7m 7s Pre-patch trunk compilation is healthy.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 tests included 0m 0s The patch appears to include 1 new or modified test files.
        +1 javac 9m 1s There were no new javac warning messages.
        +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings.
        +1 checkstyle 0m 24s There were no new checkstyle issues.
        +1 whitespace 0m 0s The patch has no lines that end in whitespace.
        +1 install 1m 42s mvn install still works.
        +1 eclipse:eclipse 0m 36s The patch built with eclipse:eclipse.
        +1 findbugs 0m 48s The patch does not introduce any new Findbugs (version 3.0.0) warnings.
        +1 common tests 2m 5s Tests passed in hadoop-kms.
            22m 11s  



        Subsystem Report/Notes
        Patch URL http://issues.apache.org/jira/secure/attachment/12766274/HADOOP-12474.000.patch
        Optional Tests javac unit findbugs checkstyle
        git revision trunk / 5b6bae0
        hadoop-kms test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7798/artifact/patchprocess/testrun_hadoop-kms.txt
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7798/testReport/
        Java 1.7.0_55
        uname Linux asf909.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7798/console

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 pre-patch 7m 7s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. +1 tests included 0m 0s The patch appears to include 1 new or modified test files. +1 javac 9m 1s There were no new javac warning messages. +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings. +1 checkstyle 0m 24s There were no new checkstyle issues. +1 whitespace 0m 0s The patch has no lines that end in whitespace. +1 install 1m 42s mvn install still works. +1 eclipse:eclipse 0m 36s The patch built with eclipse:eclipse. +1 findbugs 0m 48s The patch does not introduce any new Findbugs (version 3.0.0) warnings. +1 common tests 2m 5s Tests passed in hadoop-kms.     22m 11s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12766274/HADOOP-12474.000.patch Optional Tests javac unit findbugs checkstyle git revision trunk / 5b6bae0 hadoop-kms test log https://builds.apache.org/job/PreCommit-HADOOP-Build/7798/artifact/patchprocess/testrun_hadoop-kms.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/7798/testReport/ Java 1.7.0_55 uname Linux asf909.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/7798/console This message was automatically generated.
        Hide
        liuml07 Mingliang Liu added a comment -

        The v0 patch address this issue as we addressed the issue in HADOOP-12417.

        Show
        liuml07 Mingliang Liu added a comment - The v0 patch address this issue as we addressed the issue in HADOOP-12417 .

          People

          • Assignee:
            liuml07 Mingliang Liu
            Reporter:
            liuml07 Mingliang Liu
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development