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

[jira] [Comment Edited] (ROCKETMQ-25) Query Msg by key: Possible concurrent access to LinkedList

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

Zhanhui Li edited comment on ROCKETMQ-25 at 1/4/17 7:18 AM:
------------------------------------------------------------

Unit tests is not viable for this scenario as tools like Mockito cannot mock objects and apply multi-threads at the same time. see https://github.com/mockito/mockito/wiki/FAQ section "Is Mockito thread-safe?"
Here I would use code analysis.

when querying message by message key, the command executor needs to query multiple brokers.
See MQAdminImpl#288 On query result returns, callbacks are executed. When results return concurrently, multiple threads from Netty executor pool will concurrently access thread-unsafe container LinkedList. This would brings about exception complaining concurrent-modification.


was (Author: lizhanhui):
Unit tests is not viable for this scenario as tools like Mockito cannot mock objects and apply multi-threads at the same time. see https://github.com/mockito/mockito/wiki/FAQ section "Is Mockito thread-safe?"
Here I would use code analysis.

when querying message by message key, the command executor needs to query multiple brokers. On query result returns, callbacks are executed. When results return concurrently, multiple threads from netty executor pool will concurrently access thread-unsafe container LinkedList. This would brings about exception complaining concurrent-modification.

> Query Msg by key: Possible concurrent access to LinkedList
> ----------------------------------------------------------
>
>                 Key: ROCKETMQ-25
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-25
>             Project: Apache RocketMQ
>          Issue Type: Bug
>          Components: rocketmq-client, rocketmq-tools
>    Affects Versions: 4.0.0-incubating
>         Environment: All
>            Reporter: Zhanhui Li
>            Assignee: Xiaorui Wang
>            Priority: Minor
>             Fix For: 4.0.0-incubating
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> As queries are delivered to all brokers asynchronously, callbacks may be executed simultaneously, which results in concurrent access to LinkedList, a thread-unsafe container.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)