From 2fde99d4c6a757eb68806684943d04be4d941e25 Mon Sep 17 00:00:00 2001 From: Bright Chen Date: Wed, 24 Jul 2024 09:02:30 +0800 Subject: [PATCH 1/2] Fix rdma complie error --- .../actions/install-all-dependences/action.yml | 2 +- .github/workflows/ci-linux.yml | 17 +++++++++-------- src/brpc/rdma/rdma_endpoint.cpp | 4 ++-- src/brpc/socket.cpp | 2 +- test/run_tests.sh | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/actions/install-all-dependences/action.yml b/.github/actions/install-all-dependences/action.yml index dee35111b5..f507aa4070 100644 --- a/.github/actions/install-all-dependences/action.yml +++ b/.github/actions/install-all-dependences/action.yml @@ -2,7 +2,7 @@ runs: using: "composite" steps: - uses: ./.github/actions/install-essential-dependences - - run: sudo apt-get install -y libgoogle-glog-dev automake bison flex libboost-all-dev libevent-dev libtool pkg-config + - run: sudo apt-get install -y libgoogle-glog-dev automake bison flex libboost-all-dev libevent-dev libtool pkg-config libibverbs1 libibverbs-dev shell: bash - run: wget https://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz && tar -xf thrift-0.11.0.tar.gz shell: bash diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 56aacee37e..892ce9788e 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -61,22 +61,22 @@ jobs: - uses: ./.github/actions/install-all-dependences - uses: ./.github/actions/init-make-config with: - options: --cc=gcc --cxx=g++ --with-thrift --with-glog + options: --cc=gcc --cxx=g++ --with-thrift --with-glog --with-rdma - name: compile run: | - make -j ${{env.proc_num}} + make -j ${{env.proc_num}} gcc-compile-with-cmake-all-options: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: ./.github/actions/install-all-dependences - - name: cmake + - name: cmake run: | export CC=gcc && export CXX=g++ mkdir build cd build - cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON .. + cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON .. - name: compile run: | cd build @@ -135,7 +135,7 @@ jobs: - uses: ./.github/actions/install-all-dependences - uses: ./.github/actions/init-make-config with: - options: --cc=clang --cxx=clang++ --with-thrift --with-glog + options: --cc=clang --cxx=clang++ --with-thrift --with-glog --with-rdma - name: compile run: | make -j ${{env.proc_num}} @@ -145,12 +145,12 @@ jobs: steps: - uses: actions/checkout@v2 - uses: ./.github/actions/install-all-dependences - - name: cmake + - name: cmake run: | export CC=clang && export CXX=clang++ mkdir build cd build - cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON .. + cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON .. - name: compile run: | cd build @@ -170,7 +170,8 @@ jobs: - name: install gtest run: | sudo apt-get update - sudo apt-get install -y cmake libgtest-dev gdb && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv lib/libgtest* /usr/lib/ + sudo apt-get install -y cmake libgtest-dev gdb + cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv lib/libgtest* /usr/lib/ - uses: ./.github/actions/init-make-config with: options: --cc=clang --cxx=clang++ diff --git a/src/brpc/rdma/rdma_endpoint.cpp b/src/brpc/rdma/rdma_endpoint.cpp index 93faf4b688..4d83deacf7 100644 --- a/src/brpc/rdma/rdma_endpoint.cpp +++ b/src/brpc/rdma/rdma_endpoint.cpp @@ -1257,7 +1257,7 @@ void RdmaEndpoint::DeallocateResources() { if (_resource->comp_channel) { // destroy comp_channel will destroy this fd // so that we should remove it from epoll fd first - GetGlobalEventDispatcher(fd, _socket->_bthread_tag).RemoveConsumer(fd); + _socket->_io_event.RemoveConsumer(fd); fd = -1; if (IbvDestroyCompChannel(_resource->comp_channel) < 0) { PLOG(WARNING) << "Fail to destroy CQ channel"; @@ -1273,7 +1273,7 @@ void RdmaEndpoint::DeallocateResources() { if (Socket::Address(_cq_sid, &s) == 0) { s->_user = NULL; // do not release user (this RdmaEndpoint) if (fd >= 0) { - GetGlobalEventDispatcher(fd, _socket->_bthread_tag).RemoveConsumer(fd); + _socket->_io_event.RemoveConsumer(fd); } s->_fd = -1; // already remove fd from epoll fd s->SetFailed(); diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp index 8fcfae9c04..a5398d1a47 100644 --- a/src/brpc/socket.cpp +++ b/src/brpc/socket.cpp @@ -749,7 +749,7 @@ int Socket::OnCreated(const SocketOptions& options) { #if BRPC_WITH_RDMA CHECK(_rdma_ep == NULL); if (options.use_rdma) { - _rdma_ep = new (std::nothrow)rdma::RdmaEndpoint(m); + _rdma_ep = new (std::nothrow)rdma::RdmaEndpoint(this); if (!_rdma_ep) { const int saved_errno = errno; PLOG(ERROR) << "Fail to create RdmaEndpoint"; diff --git a/test/run_tests.sh b/test/run_tests.sh index ebd648402a..4920aaad33 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -22,7 +22,7 @@ rm core.* test_num=0 failed_test="" rc=0 -test_bins="test_butil test_bvar bthread*unittest brpc*unittest" +test_bins="brpc_rdma_unittest brpc_socket_unittest" for test_bin in $test_bins; do test_num=$((test_num + 1)) >&2 echo "[runtest] $test_bin" From e9d025becd3ef6dcb123a424612a6f564080e9bb Mon Sep 17 00:00:00 2001 From: Bright Chen Date: Wed, 24 Jul 2024 14:16:41 +0800 Subject: [PATCH 2/2] Fix ut bins --- test/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run_tests.sh b/test/run_tests.sh index 4920aaad33..ebd648402a 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -22,7 +22,7 @@ rm core.* test_num=0 failed_test="" rc=0 -test_bins="brpc_rdma_unittest brpc_socket_unittest" +test_bins="test_butil test_bvar bthread*unittest brpc*unittest" for test_bin in $test_bins; do test_num=$((test_num + 1)) >&2 echo "[runtest] $test_bin"