You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/03/25 14:34:48 UTC
(doris) 11/12: [fix](brpc) check failed socket before SetConnected (#32790)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 3c74d4a4efff6d8d9ab7bd5557a8176c83775a9b
Author: Kaijie Chen <ck...@apache.org>
AuthorDate: Mon Mar 25 22:09:09 2024 +0800
[fix](brpc) check failed socket before SetConnected (#32790)
---
.../brpc-1.4.0-fix-stream-rpc-set-connected.patch | 40 ++++++++++++++++++----
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/thirdparty/patches/brpc-1.4.0-fix-stream-rpc-set-connected.patch b/thirdparty/patches/brpc-1.4.0-fix-stream-rpc-set-connected.patch
index 8e122a57b8f..4328165cfdb 100644
--- a/thirdparty/patches/brpc-1.4.0-fix-stream-rpc-set-connected.patch
+++ b/thirdparty/patches/brpc-1.4.0-fix-stream-rpc-set-connected.patch
@@ -1,20 +1,48 @@
-From 9acc6ef89d8770d5516953e2eadf0c27a7d424fc Mon Sep 17 00:00:00 2001
+From 031194784d540235dfa6ba56bd196a7aad92e30c Mon Sep 17 00:00:00 2001
From: Kaijie Chen <ck...@apache.org>
Date: Sun, 28 Jan 2024 15:58:31 +0800
Subject: [PATCH] fix set connected for stream rpc
---
- src/brpc/policy/baidu_rpc_protocol.cpp | 11 +++++------
- 1 file changed, 5 insertions(+), 6 deletions(-)
+ src/brpc/policy/baidu_rpc_protocol.cpp | 25 ++++++++++++++++++-------
+ 1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/brpc/policy/baidu_rpc_protocol.cpp b/src/brpc/policy/baidu_rpc_protocol.cpp
-index 0239960e..c47903a6 100644
+index 0239960e..e8a90e34 100644
--- a/src/brpc/policy/baidu_rpc_protocol.cpp
+++ b/src/brpc/policy/baidu_rpc_protocol.cpp
-@@ -234,6 +234,11 @@ void SendRpcResponse(int64_t correlation_id,
+@@ -25,6 +25,7 @@
+ #include "butil/iobuf.h" // butil::IOBuf
+ #include "butil/raw_pack.h" // RawPacker RawUnpacker
+ #include "brpc/controller.h" // Controller
++#include "brpc/errno.pb.h"
+ #include "brpc/socket.h" // Socket
+ #include "brpc/server.h" // Server
+ #include "brpc/span.h"
+@@ -212,7 +213,9 @@ void SendRpcResponse(int64_t correlation_id,
+ if (Socket::Address(response_stream_id, &stream_ptr) == 0) {
+ Stream* s = (Stream*)stream_ptr->conn();
+ s->FillSettings(meta.mutable_stream_settings());
+- s->SetHostSocket(sock);
++ if (s->SetHostSocket(sock) != 0) {
++ LOG(WARNING) << "SetHostSocket failed";
++ }
+ } else {
+ LOG(WARNING) << "Stream=" << response_stream_id
+ << " was closed before sending response";
+@@ -234,6 +237,20 @@ void SendRpcResponse(int64_t correlation_id,
// Send rpc response over stream even if server side failed to create
// stream for some reasons.
if(cntl->has_remote_stream()){
++ if (sock->Failed()) {
++ LOG(WARNING) << "Fail to write into " << *sock;
++ cntl->SetFailed(EFAILEDSOCKET, "Fail to write into %s",
++ sock->description().c_str());
++ if (stream_ptr) {
++ ((Stream *)stream_ptr->conn())->Close();
++ }
++ return;
++ }
+ if(stream_ptr) {
+ // Now it's ok the mark this server-side stream as connectted as all the
+ // written user data would follower the RPC response.
@@ -23,7 +51,7 @@ index 0239960e..c47903a6 100644
// Send the response over stream to notify that this stream connection
// is successfully built.
// Response_stream can be INVALID_STREAM_ID when error occurs.
-@@ -249,12 +254,6 @@ void SendRpcResponse(int64_t correlation_id,
+@@ -249,12 +266,6 @@ void SendRpcResponse(int64_t correlation_id,
}
return;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org