Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Master][Bug] concurrent map r/w in roundRobinQueueSelector causes panic #651

Closed
czah opened this issue May 6, 2021 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@czah
Copy link
Contributor

czah commented May 6, 2021

  1. Please describe the issue you observed:

    • What did you do (The steps to reproduce)?
      Run a producer and start producing messages.

    • What did you expect to see?
      Everything is working well.

    • What did you see instead?
      It panicked with a error message (as shown below):

fatal error: concurrent map read and map write

goroutine 4877278 [running]:
runtime.throw(0xe50ffa, 0x21)
	/usr/local/go/src/runtime/panic.go:774 +0x72 fp=0xc000be4b20 sp=0xc000be4af0 pc=0x431182
runtime.mapaccess2_faststr(0xd0cea0, 0xc00031c810, 0xc0004b2f14, 0x5, 0x100000000000000, 0xd6cf00)
	/usr/local/go/src/runtime/map_faststr.go:116 +0x48f fp=0xc000be4b90 sp=0xc000be4b20 pc=0x414c5f
github.com/apache/rocketmq-client-go/v2/producer.(*roundRobinQueueSelector).Select(0xc0002b5700, 0xc0002663f0, 0xc001204400, 0x6, 0x8, 0x101)
	/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/producer/selector.go:77 +0x5f fp=0xc000be4be8 sp=0xc000be4b90 pc=0xc2ae5f
github.com/apache/rocketmq-client-go/v2/producer.(*defaultProducer).selectMessageQueue(0xc000234ea0, 0xc0002663f0, 0xc00146c1e0)
	/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/producer/producer.go:396 +0x182 fp=0xc000be4c90 sp=0xc000be4be8 pc=0xc2a952
...

It was caused by an unprotected read op on the map named indexer in roundRobinQueueSelector.

  1. Please tell us about your environment:

    • What is your OS?
      A Docker container based on the CentOS 7.3 image (host kernel version: 4.9.2-3.0.0.std7b.el7.5.x86_64)

    • What is your client version?
      v2.1.0-rc6

    • What is your RocketMQ version?
      v4.8

  2. Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):

@maixiaohai maixiaohai added the bug Something isn't working label May 6, 2021
@czah czah changed the title [Master] Bug: concurrent map r/w in roundRobinSelector causes panic [Master] Bug: concurrent map r/w in roundRobinQueueSelector causes panic May 6, 2021
@czah czah changed the title [Master] Bug: concurrent map r/w in roundRobinQueueSelector causes panic [Master][Bug] concurrent map r/w in roundRobinQueueSelector causes panic May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants