dbl-x opened a new issue #527:
URL: https://github.com/apache/rocketmq-client-go/issues/527
**BUG REPORT**
**Please add the branch name [Native]/[Master] at the header of the Isssue
title.**
1. Please describe the issue you observed:
- When concurrent UpdateNameServerAddress and getNameServerAddress,
because namesrvs.srvs has changed, and namesrvs.index is not adjusted
accordingly, the execution of "s.srvs[s.index]" causes the array to out of range
2. Please tell us about your environment:
- rocketmq-client-go: v2.1.0-rc4 and master
3. Other information (e.g. detailed explanation, logs, related issues,
suggestions on how to fix, etc):
```
panic: runtime error: index out of range [5] with length 5
goroutine 257 [running]:
github.com/apache/rocketmq-client-go/v2/internal.(*namesrvs).getNameServerAddress(0xc000c92240,
0x0, 0x0)
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/namesrv.go:123
+0x16d
github.com/apache/rocketmq-client-go/v2/internal.(*namesrvs).queryTopicRouteInfoFromServer(0xc000c92240,
0xc000eb9580, 0x31, 0x479ad0, 0xc00194ebe0, 0xc000760340)
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/route.go:355
+0x274
github.com/apache/rocketmq-client-go/v2/internal.(*namesrvs).UpdateTopicRouteInfoWithDefault(0xc000c92240,
0xc000eb9580, 0x31, 0x0, 0x0, 0x0, 0x0, 0xc000a7f200, 0x0, 0x0)
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/route.go:132
+0xcf
github.com/apache/rocketmq-client-go/v2/internal.(*namesrvs).UpdateTopicRouteInfo(...)
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/route.go:116
github.com/apache/rocketmq-client-go/v2/internal.(*rmqClient).UpdateTopicRouteInfo(0xc0007fe340)
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/client.go:527
+0x17d
github.com/apache/rocketmq-client-go/v2/internal.(*rmqClient).Start.func1.2.1(...)
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/client.go:292
github.com/apache/rocketmq-client-go/v2/internal.(*rmqClient).Start.func1.2()
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/client.go:302
+0x156
github.com/apache/rocketmq-client-go/v2/primitive.WithRecover(0xc000760430)
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/primitive/base.go:96
+0x49
created by
github.com/apache/rocketmq-client-go/v2/internal.(*rmqClient).Start.func1
/go/pkg/mod/github.com/apache/rocketmq-client-go/[email protected]/internal/client.go:289
+0x10e
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]