You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "zhaoziyan (JIRA)" <ji...@apache.org> on 2017/04/07 08:14:42 UTC

[jira] [Created] (ROCKETMQ-167) namesrv RouteInfoManager scanNotActiveBroker have the Thread competition

zhaoziyan created ROCKETMQ-167:
----------------------------------

             Summary: namesrv RouteInfoManager scanNotActiveBroker  have the Thread competition
                 Key: ROCKETMQ-167
                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-167
             Project: Apache RocketMQ
          Issue Type: Bug
          Components: rocketmq-namesrv
    Affects Versions: 4.0.0-incubating
            Reporter: zhaoziyan
            Assignee: Xiaorui Wang


    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 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)