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

Query Msg by key: Possible concurrent access to LinkedList

    Details

      Description

      As queries are delivered to all brokers asynchronously, callbacks may be executed simultaneously, which results in concurrent access to LinkedList, a thread-unsafe container.

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user lizhanhui opened a pull request:

          https://github.com/apache/incubator-rocketmq/pull/22

          ROCKETMQ-25 Possible data race while query msg by key

          Refer to JIRA: https://issues.apache.org/jira/browse/ROCKETMQ-25

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/lizhanhui/incubator-rocketmq master

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/incubator-rocketmq/pull/22.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #22


          commit 89e5898a59f64d0468d5d43215d22764c73ff081
          Author: Zhanhui Li <lizhanhui@apache.org>
          Date: 2016-12-29T06:58:59Z

          Fix data race issue


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user lizhanhui opened a pull request: https://github.com/apache/incubator-rocketmq/pull/22 ROCKETMQ-25 Possible data race while query msg by key Refer to JIRA: https://issues.apache.org/jira/browse/ROCKETMQ-25 You can merge this pull request into a Git repository by running: $ git pull https://github.com/lizhanhui/incubator-rocketmq master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-rocketmq/pull/22.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #22 commit 89e5898a59f64d0468d5d43215d22764c73ff081 Author: Zhanhui Li <lizhanhui@apache.org> Date: 2016-12-29T06:58:59Z Fix data race issue
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user lollipopjin commented on the issue:

          https://github.com/apache/incubator-rocketmq/pull/22

          @lizhanhui Could you please verify mentioned problem, no matter using unit or other ways. At last, please fix the conflict problem.

          Show
          githubbot ASF GitHub Bot added a comment - Github user lollipopjin commented on the issue: https://github.com/apache/incubator-rocketmq/pull/22 @lizhanhui Could you please verify mentioned problem, no matter using unit or other ways. At last, please fix the conflict problem.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user lizhanhui closed the pull request at:

          https://github.com/apache/incubator-rocketmq/pull/22

          Show
          githubbot ASF GitHub Bot added a comment - Github user lizhanhui closed the pull request at: https://github.com/apache/incubator-rocketmq/pull/22
          Hide
          lizhanhui Zhanhui Li added a comment - - edited

          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.

          Show
          lizhanhui Zhanhui Li added a comment - - edited 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.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit b421d48c476e74a8c7bb8129979df1dc0cb5a5a5 in incubator-rocketmq's branch refs/heads/master from Zhanhui Li
          [ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=b421d48 ]

          Fix https://issues.apache.org/jira/browse/ROCKETMQ-25

          Show
          jira-bot ASF subversion and git services added a comment - Commit b421d48c476e74a8c7bb8129979df1dc0cb5a5a5 in incubator-rocketmq's branch refs/heads/master from Zhanhui Li [ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=b421d48 ] Fix https://issues.apache.org/jira/browse/ROCKETMQ-25

            People

            • Assignee:
              vintagewang Xiaorui Wang
              Reporter:
              lizhanhui Zhanhui Li
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development