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

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

    [ https://issues.apache.org/jira/browse/ROCKETMQ-167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15976166#comment-15976166 ] 

yukon commented on ROCKETMQ-167:
--------------------------------

Thanks, there is a concurrent issue indeed, but scanNotActiveBroker will recover even encounter a exception.

> 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
>
> {code}
>     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());
>             }
>         }
>     }
> {code}
> 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)