-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
standard JSON dont compat with go client #4471
Comments
@yuz10 good catch, would you like to submit a PR to temporarily change back to the previous way to ensure compatibility with old clients? Then start a discussion to provide standard JSON under the premise of ensuring compatibility, such as adding new interfaces or judging according to the protocol version |
sure |
@yuz10 Should create an issue to the go-sdk, making it compatible with standard JSON. For the ops, upgrade client first then the server. Let name server generate invalid JSON would cause C++ client coredump from time to time. |
The go code posted here is manually parsing strings bit by bit, which itself is error-prone. This is not the supposed way of deserializating JSON |
I have submit an pull request in go sdk, but there is a compatability problem |
@yuz10 Let's make things work this way |
@yuz10 It is suggested to use the explicit header field "acceptStandardJsonOnly" instead of relying on the version code. |
apache/rocketmq-client-go#845
BUG REPORT
in #4432 , the response of GET_ROUTEINFO_BY_TOPIC is changed, for example, the new format is:
{"brokerDatas":[{"brokerAddrs":{"0":"127.0.0.1:10911"}]}
the old is:
{"brokerDatas":[{"brokerAddrs":{0:"127.0.0.1:10911"}]}
the following go code in https://github.com/apache/rocketmq-client-go/blob/master/internal/route.go#L561
in
id, _ := strconv.ParseInt(str[0:i], 10, 64)
, if broker id is 1, thenstr[0:i]
is"\"1\""
, andstrconv.ParseInt("\"1\"")
will always be 0so the producer will send message to slave.
I have submit a pull request in rocketmq-client-go, apache/rocketmq-client-go#846, but I think we should also be compatable with the old versions of go client.
Please tell us about your environment:
Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):
The text was updated successfully, but these errors were encountered: