-
Notifications
You must be signed in to change notification settings - Fork 424
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
fatal error: concurrent map writes #139
Labels
bug
Something isn't working
Milestone
Comments
it must add locker for CAS, so in func (local *localFileOffsetStore) update(mq *primitive.MessageQueue, offset int64, increaseOnly bool) {
rlog.Debugf("update offset: %s to %d", mq, offset)
localOffset, exist := local.OffsetTable[mq.Topic]
if !exist {
localOffset = make(map[int]*queueOffset)
local.OffsetTable[mq.Topic] = localOffset
}
q, exist := localOffset[mq.QueueId]
if !exist {
q = &queueOffset{
QueueID: mq.QueueId,
Broker: mq.BrokerName,
}
localOffset[mq.QueueId] = q
}
if increaseOnly {
if q.Offset < offset {
q.Offset = offset
}
} else {
q.Offset = offset
}
}```
it will add
```golang
func (local *localFileOffsetStore) update(mq *primitive.MessageQueue, offset int64, increaseOnly bool) {
local.mutex.Lock()
defer local.mutex.Unlock() |
Thank you @wolftankk! could you create a PR for this issue? |
@wolftankk Could you please create a PR to fix this issue? |
wolftankk
added a commit
to wolftankk/rocketmq-client-go
that referenced
this issue
Aug 8, 2019
Sure. |
zongtanghu
pushed a commit
that referenced
this issue
Aug 13, 2019
fixed at #146 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the newest sdk, get the errors:
test code:
The text was updated successfully, but these errors were encountered: