You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ww...@apache.org on 2022/12/06 05:56:20 UTC
[incubator-brpc] branch master updated: fix bug: QP cannot be put back to QP pool (#2036)
This is an automated email from the ASF dual-hosted git repository.
wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 8efcf9cf fix bug: QP cannot be put back to QP pool (#2036)
8efcf9cf is described below
commit 8efcf9cf3d191e209351ca579278c984f6241a83
Author: Tuvie <li...@gmail.com>
AuthorDate: Tue Dec 6 13:56:14 2022 +0800
fix bug: QP cannot be put back to QP pool (#2036)
* return 0 for append_user_data_with_meta when size=0
* fix bug: QP cannot be put back to QP pool
---
src/brpc/rdma/rdma_endpoint.cpp | 9 +++++++--
src/butil/iobuf.cpp | 4 ----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/brpc/rdma/rdma_endpoint.cpp b/src/brpc/rdma/rdma_endpoint.cpp
index 49daa8f8..fe282b64 100644
--- a/src/brpc/rdma/rdma_endpoint.cpp
+++ b/src/brpc/rdma/rdma_endpoint.cpp
@@ -1211,7 +1211,8 @@ void RdmaEndpoint::DeallocateResources() {
}
bool move_to_rdma_resource_list = false;
if (_sq_size <= FLAGS_rdma_prepared_qp_size &&
- _rq_size <= FLAGS_rdma_prepared_qp_size) {
+ _rq_size <= FLAGS_rdma_prepared_qp_size &&
+ FLAGS_rdma_prepared_qp_cnt > 0) {
ibv_qp_attr attr;
attr.qp_state = IBV_QPS_RESET;
if (IbvModifyQp(_resource->qp, &attr, IBV_QP_STATE) == 0) {
@@ -1224,12 +1225,14 @@ void RdmaEndpoint::DeallocateResources() {
if (IbvDestroyQp(_resource->qp) < 0) {
PLOG(WARNING) << "Fail to destroy QP";
}
+ _resource->qp = NULL;
}
if (_resource->cq) {
IbvAckCqEvents(_resource->cq, _cq_events);
if (IbvDestroyCq(_resource->cq) < 0) {
PLOG(WARNING) << "Fail to destroy CQ";
}
+ _resource->cq = NULL;
}
if (_resource->comp_channel) {
// destroy comp_channel will destroy this fd
@@ -1239,8 +1242,10 @@ void RdmaEndpoint::DeallocateResources() {
if (IbvDestroyCompChannel(_resource->comp_channel) < 0) {
PLOG(WARNING) << "Fail to destroy CQ channel";
}
+ _resource->comp_channel = NULL;
}
delete _resource;
+ _resource = NULL;
}
SocketUniquePtr s;
@@ -1256,7 +1261,7 @@ void RdmaEndpoint::DeallocateResources() {
_cq_sid = INVALID_SOCKET_ID;
}
- if (!move_to_rdma_resource_list) {
+ if (move_to_rdma_resource_list) {
if (_resource->cq) {
IbvAckCqEvents(_resource->cq, _cq_events);
}
diff --git a/src/butil/iobuf.cpp b/src/butil/iobuf.cpp
index b2a43386..b585c92c 100644
--- a/src/butil/iobuf.cpp
+++ b/src/butil/iobuf.cpp
@@ -1217,10 +1217,6 @@ int IOBuf::append_user_data_with_meta(void* data,
size_t size,
void (*deleter)(void*),
uint64_t meta) {
- if (size == 0) {
- LOG(WARNING) << "data_size should not be 0";
- return -1;
- }
if (size > 0xFFFFFFFFULL - 100) {
LOG(FATAL) << "data_size=" << size << " is too large";
return -1;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org