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
rpcx sendraw response Error #371
Comments
以下是出现问题的 log call payload: 和 chan payload: 打印 |
你的rpcx的版本? |
go mod github.com/smallnest/rpcx v0.0.0-20191008054500-6a4c1b1de0fa |
|
|
|
fixed, 你拉取一下代码试试 |
好,谢谢大神 |
留记号:看来平常应该关注这里的bug fix; |
env: go 1.12.1
rpcx: github.com/smallnest/rpcx v0.0.0-20191008054500-6a4c1b1de0fa
使用client.sendraw, SerializeType:protobuf
响应的PB格式:
import "google/protobuf/any.proto";
// response
message Resp {
int32 code = 1; // 返回码
uint64 req_time = 2; // 请求时间
uint64 time = 3; // 当前服务器时间
string msg = 4;
google.protobuf.Any data = 5;
}
使用:
go funcA() { client.Sendraw(....) }()
go funcB() { client.Sendraw(....) }()
同时请求同一个servicepath和servicemethod,偶尔出现sendraw响应的payload错误(貌似内存被覆盖)。
在client/client.go 的input接收数据时:
if call.Raw {
call.Metadata, call.Reply, _ = convertRes2Raw(res)
log.Info("call payload: ", call.Reply, "args=", call.Args)
} 这里的call.Reply的内容是正确的,然后进入call.done(),将call对象发给call内部的channel,
在channel接收数据后
select {
.....
case call := <-done:
err = call.Error
m = call.Metadata
if call.Reply != nil {
// 这里的call.Reply的数据(protobuf的marshal)偶尔出现问题,和上面client.input时接收的不一致
log.Info("chan payload: ", call.Reply, "args=", call.Args)
payload = call.Reply.([]byte)
}
}
}
求大神指导下
The text was updated successfully, but these errors were encountered: