You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@brpc.apache.org by "W-Xu (via GitHub)" <gi...@apache.org> on 2026/01/29 14:26:04 UTC
[I] 客户端服务端proto不一致的情况下,ParsePbFromIOBuf 会稳定小概率反序列化解析失败 (brpc)
W-Xu opened a new issue, #3207:
URL: https://github.com/apache/brpc/issues/3207
**Describe the bug**
在客户端的 proto 文件添加新字段之后,服务端未更新的情况下(proto文件见附录),高 qps 的情况下 ParsePbFromIOBuf 会稳定小概率反序列化解析失败。报错路径为:
http_rpc_protocol.cpp文件
if (content_type == HTTP_CONTENT_PROTO) {
if (!ParsePbFromIOBuf(req, req_body)) {
cntl->SetFailed(EREQUEST, "Fail to parse http body as %s",
request_full_name.c_str());
return;
}
……
protocol.cpp文件
bool ParsePbFromIOBuf(google::protobuf::Message* msg, const butil::IOBuf& buf) {
butil::IOBufAsZeroCopyInputStream stream(buf);
return ParsePbFromZeroCopyStreamInlined(msg, &stream);
}
如果把 [IOBufAsZeroCopyInputStream](butil::IOBufAsZeroCopyInputStream stream(buf);) 修改为
std::string flat;
buf.copy_to(&flat);
// 用 ArrayInputStream代替
google::protobuf::io::ArrayInputStream ais(flat.data(), flat.size());
问题就会修复。
1、辛苦确认一下,这个地方是否有问题?或者有更好的使用建议吗?
2、如果有问题,这个地方用的 IOBufAsZeroCopyInputStream 看起来是问题所在,是否有更好修改建议?
附录:
proto文件
message BatchRequest {
string aaa = 1;
repeated int32 bbb = 2;
string ccc = 3;
repeated Request requests = 4;
int32 ddd = 5;
repeated uint64 eee = 6;
int32 fff = 7;
// Optional. name
// 客户端添加这个字段,服务端不添加这个字段有问题
string name = 8;
}
--
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.
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org
Re: [I] 客户端服务端proto不一致的情况下,ParsePbFromIOBuf 会稳定小概率反序列化解析失败 (brpc)
Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright closed issue #3207: 客户端服务端proto不一致的情况下,ParsePbFromIOBuf 会稳定小概率反序列化解析失败
URL: https://github.com/apache/brpc/issues/3207
--
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.
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org
Re: [I] 客户端服务端proto不一致的情况下,ParsePbFromIOBuf 会稳定小概率反序列化解析失败 (brpc)
Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #3207:
URL: https://github.com/apache/brpc/issues/3207#issuecomment-4067424164
@W-Xu Please try using #3242 to fix this issue.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org