binarycopycode opened a new issue, #2472:
URL: https://github.com/apache/brpc/issues/2472

    **Describe the bug (描述bug)**
   
   本地环境下  执行RegisterMemoryForRdma发生 Segmentation fault
   
   
   **To Reproduce (复现方法)**
   
   代码见附录,编译完之后
   执行`ulimit -n 204800`
   再执行`./server -rdma_memory_pool_initial_size_mb=128`
   
   **Versions (各种版本)**
   RoCE 
   虚拟机 ubuntu22.04 
   gcc 11.4
   libprotoc 3.12.4
   
   `lfw@lfw-vm:~$ rdma link show`
   `link rxe_0/1 state ACTIVE physical_state LINK_UP netdev ens33 `
   
   **Additional context/screenshots (更多上下文/截图)**
   
   ![gdb 
](https://github.com/binarycopycode/brpc_rdma_transfile/assets/34117975/70a62aee-a7db-46a5-b789-1688a77dc32c)
   
   
   //server.cpp
   #include <iostream>
   #include <fstream>
   #include <filesystem>
   
   #include <gflags/gflags.h>
   #include "butil/atomicops.h"
   #include "butil/logging.h"
   #include "butil/time.h"
   #include "butil/iobuf.h"
   #include "brpc/server.h"
   #include "bvar/variable.h"
   #include "brpc/rdma/block_pool.h"
   #include "brpc/rdma/rdma_endpoint.h"
   #include "brpc/rdma/rdma_helper.h"
   
   #ifdef BRPC_WITH_RDMA
   
   DEFINE_int32(port, 8002, "TCP Port of this server");
   DEFINE_bool(use_rdma, true, "Use RDMA or not");
   
   
   int read_data()
   {
       int file_size = 4096;
       char* data = (char*)malloc(4096);
       memset(data, 0x3f, 4096);
       uint32_t lkey = brpc::rdma::RegisterMemoryForRdma(data, 4096);
       if(lkey == 0)
       {
           std::cout << "regist failed" << std::endl;
           return -1;
       }
       std::cout << "register data success" << std::endl; 
       return 0;
   }
   
   int main(int argc, char* argv[]) {
       GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
   
       
       if(read_data() < 0)
       {
           LOG(ERROR) << "Fail to read data";
           return -1;
       }
       return 0;
   }
   
   #else
   int main(int argc, char* argv[]) {
       LOG(ERROR) << " brpc is not compiled with rdma. To enable it, please 
refer to https://github.com/apache/brpc/blob/master/docs/en/rdma.md";;
       return 0;
   }
   #endif
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to