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

namesrv RouteInfoManager scanNotActiveBroker have the Thread competition

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Feedback Received
    • 4.0.0-incubating
    • 4.2.0
    • rocketmq-namesrv
    • None

    Description

          public void scanNotActiveBroker() {
              Iterator<Entry<String, BrokerLiveInfo>> it = this.brokerLiveTable.entrySet().iterator();
              while (it.hasNext()) {
                  Entry<String, BrokerLiveInfo> next = it.next();
                  long last = next.getValue().getLastUpdateTimestamp();
                  if ((last + BROKER_CHANNEL_EXPIRED_TIME) < System.currentTimeMillis()) {
                      RemotingUtil.closeChannel(next.getValue().getChannel());
                      it.remove();
                      log.warn("The broker channel expired, {} {}ms", next.getKey(), BROKER_CHANNEL_EXPIRED_TIME);
                      this.onChannelDestroy(next.getKey(), next.getValue().getChannel());
                  }
              }
          }
      

      scanNotActiveBroker dont have the writelock ,but it is modify the brokerLiveTable and Iterator the brokerLiveTable .
      NSScheduledThread and nettyeventExcutor Thread have the competition.
      The scanNotActiveBroker may throw
      java.util.ConcurrentModificationException: null
      and nevel run again

      Attachments

        Activity

          People

            yukon Xinyu Zhou
            zhaoziyan zhaoziyan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment