You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Michi Mutsuzaki (JIRA)" <ji...@apache.org> on 2014/01/13 20:06:59 UTC

[jira] [Commented] (ZOOKEEPER-1861) ConcurrentHashMap isn't used properly in QuorumCnxManager

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

Michi Mutsuzaki commented on ZOOKEEPER-1861:
--------------------------------------------

Thank you for the bug report Ted. Would it be ok if I assign the ticket to you?

> ConcurrentHashMap isn't used properly in QuorumCnxManager
> ---------------------------------------------------------
>
>                 Key: ZOOKEEPER-1861
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1861
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> queueSendMap is a ConcurrentHashMap.
> At line 210:
> {code}
>             if (!queueSendMap.containsKey(sid)) {
>                 queueSendMap.put(sid, new ArrayBlockingQueue<ByteBuffer>(
>                         SEND_CAPACITY));
> {code}
> By the time control enters if block, there may be another concurrent put with same sid to the ConcurrentHashMap.
> putIfAbsent() should be used.
> Similar issue occurs at line 307 as well.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)