From 2a00420addf6e920c06100d85404337d5b84231f Mon Sep 17 00:00:00 2001 From: 372046933 <372046933@users.noreply.github.com> Date: Thu, 10 Nov 2022 17:29:30 +0800 Subject: [PATCH] Fall back to libibverbs.so.1 (#1985) --- docs/cn/rdma.md | 4 ++-- docs/en/rdma.md | 4 ++-- src/brpc/rdma/rdma_helper.cpp | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/cn/rdma.md b/docs/cn/rdma.md index 645b285e4a..57a1396493 100644 --- a/docs/cn/rdma.md +++ b/docs/cn/rdma.md @@ -24,9 +24,9 @@ make 使用bazel: ```bash # Server -bazel build example:rdma_performance_server +bazel build --define=BRPC_WITH_RDMA=true example:rdma_performance_server # Client -bazel build example:rdma_performance_client +bazel build --define=BRPC_WITH_RDMA=true example:rdma_performance_client ``` # 基本实现 diff --git a/docs/en/rdma.md b/docs/en/rdma.md index e76a01de20..e187807fbd 100644 --- a/docs/en/rdma.md +++ b/docs/en/rdma.md @@ -24,9 +24,9 @@ make With bazel: ```bash # Server -bazel build example:rdma_performance_server +bazel build --define=BRPC_WITH_RDMA=true example:rdma_performance_server # Client -bazel build example:rdma_performance_client +bazel build --define=BRPC_WITH_RDMA=true example:rdma_performance_client ``` # Basic Implementation diff --git a/src/brpc/rdma/rdma_helper.cpp b/src/brpc/rdma/rdma_helper.cpp index 75de2e4f9d..536398c9ac 100644 --- a/src/brpc/rdma/rdma_helper.cpp +++ b/src/brpc/rdma/rdma_helper.cpp @@ -326,8 +326,14 @@ static void OnRdmaAsyncEvent(Socket* m) { static int ReadRdmaDynamicLib() { g_handle_ibverbs = dlopen("libibverbs.so", RTLD_LAZY); if (!g_handle_ibverbs) { - LOG(ERROR) << "Fail to load libibverbs.so due to " << dlerror(); - return -1; + LOG(WARNING) << "Failed to load libibverbs.so " << dlerror() << " try libibverbs.so.1"; + // Clear existing error + dlerror(); + g_handle_ibverbs = dlopen("libibverbs.so.1", RTLD_LAZY); + if (!g_handle_ibverbs) { + LOG(ERROR) << "Fail to load libibverbs.so.1 due to " << dlerror(); + return -1; + } } LoadSymbol(g_handle_ibverbs, IbvGetDeviceList, "ibv_get_device_list");