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

MiniKMS should use random ports for Jetty server by default

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.0, 3.0.0-alpha1
    • None
    • None
    • 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.

      Attachments

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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            liuml07 Mingliang Liu
            liuml07 Mingliang Liu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment