You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "kaijchen (via GitHub)" <gi...@apache.org> on 2024/01/28 12:26:54 UTC
[PR] Fix: set connected before send stream data (brpc)
kaijchen opened a new pull request, #2525:
URL: https://github.com/apache/brpc/pull/2525
### What problem does this PR solve?
Issue Number:
Problem Summary:
We have met a problem in Apache Doris where a stream rpc client cannot receive any message (including `on_closed`) from stream server.
https://github.com/apache/doris/pull/30476
### What is changed and the side effects?
Changed:
Side effects:
- Performance effects(性能影响):
- Breaking backward compatibility(向后兼容性):
---
### Check List:
- Please make sure your changes are compilable(请确保你的更改可以通过编译).
- When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
- Please follow [Contributor Covenant Code of Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [PR] Fix: set connected before send stream data (brpc)
Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #2525:
URL: https://github.com/apache/brpc/pull/2525#discussion_r1477177349
##########
src/brpc/policy/baidu_rpc_protocol.cpp:
##########
@@ -247,6 +247,11 @@ void SendRpcResponse(int64_t correlation_id,
// Send rpc response over stream even if server side failed to create
// stream for some reason.
if(cntl->has_remote_stream()){
+ if (stream_ptr) {
Review Comment:
加了,我们的场景是服务端收到一个 EOS 消息后主动关闭 stream。
在单机测试下,出现了客户端收不到 on_closed 的问题。
这里 response 先发了包,但还未设置 connected,导致 close frame 没发出去

--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [PR] Fix: potential missing on_closed message on client-side (brpc)
Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #2525:
URL: https://github.com/apache/brpc/pull/2525#discussion_r1477177349
##########
src/brpc/policy/baidu_rpc_protocol.cpp:
##########
@@ -247,6 +247,11 @@ void SendRpcResponse(int64_t correlation_id,
// Send rpc response over stream even if server side failed to create
// stream for some reason.
if(cntl->has_remote_stream()){
+ if (stream_ptr) {
Review Comment:
加了,我们在单机测试下,出现了客户端收不到 on_closed 的问题:
1. 服务端 send response 先发了包,但还未设置 connected。
2. 客户端收到 open 成功,处理完后续逻辑,执行 stream close。
3. 服务端收到 on_closed 时候,set connected 还未执行,导致 close frame 没发出去。

--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [PR] Fix: set connected before send stream data (brpc)
Posted by "chenzhangyi (via GitHub)" <gi...@apache.org>.
chenzhangyi commented on code in PR #2525:
URL: https://github.com/apache/brpc/pull/2525#discussion_r1472850682
##########
src/brpc/policy/baidu_rpc_protocol.cpp:
##########
@@ -247,6 +247,11 @@ void SendRpcResponse(int64_t correlation_id,
// Send rpc response over stream even if server side failed to create
// stream for some reason.
if(cntl->has_remote_stream()){
+ if (stream_ptr) {
Review Comment:
能不能加一个注释说明下为什么SetConnected一定要在发消息之前设置吗?
如果这里有race的话,后面需要加一个barrier不?
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [PR] Fix: potential missing on_closed message on client-side (brpc)
Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on PR #2525:
URL: https://github.com/apache/brpc/pull/2525#issuecomment-2029065463
StreamingRpcTest.server_send_data_before_run_done 这个单测失败了,是不是和改动有关?
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [PR] Fix: potential missing on_closed message on client-side (brpc)
Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on code in PR #2525:
URL: https://github.com/apache/brpc/pull/2525#discussion_r1537446669
##########
src/brpc/policy/baidu_rpc_protocol.cpp:
##########
@@ -247,6 +247,11 @@ void SendRpcResponse(int64_t correlation_id,
// Send rpc response over stream even if server side failed to create
// stream for some reason.
if(cntl->has_remote_stream()){
+ if (stream_ptr) {
Review Comment:
代码和注释更新了,请再看一下。
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org