Uploaded image for project: 'Apache RocketMQ'
  1. Apache RocketMQ
  2. ROCKETMQ-250

fix fetchNSAddr error when it refer to jmenv.tbsite.net

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1.0-incubating
    • 4.2.0
    • rocketmq-commons
    • None
    • test and production

    Description

      *strong text*jmenv.tbsite.net may can not be reached in inner envirment when find it periodly
      we can return null when application does not set the new wsAddr.

      public final String fetchNSAddr(boolean verbose, long timeoutMills) {
              String url = this.wsAddr;
              try {
                  if (this.wsAddr.equals(MixAll.WS_ADDR)) {
                      return null;
                  }
                  if (!UtilAll.isBlank(this.unitName)) {
                      url = url + "-" + this.unitName + "?nofix=1";
                  }
                  HttpTinyClient.HttpResult result = HttpTinyClient.httpGet(url, null, null, "UTF-8", timeoutMills);
                  if (200 == result.code) {
                      String responseStr = result.content;
                      if (responseStr != null) {
                          return clearNewLine(responseStr);
                      } else {
                          log.error("fetch nameserver address is null");
                      }
                  } else {
                      log.error("fetch nameserver address failed. statusCode={}", result.code);
                  }
              } catch (IOException e) {
                  if (verbose) {
                      log.error("fetch name server address exception", e);
                  }
              }
      
              if (verbose) {
                  String errorMsg =
                      "connect to " + url + " failed, maybe the domain name " + MixAll.getWSAddr() + " not bind in /etc/hosts";
                  errorMsg += FAQUrl.suggestTodo(FAQUrl.NAME_SERVER_ADDR_NOT_EXIST_URL);
      
                  log.warn(errorMsg);
              }
              return null;
          }
      

      Attachments

        Activity

          People

            lollipop Jixiang Jin
            easonchen Eason Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: