You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "binarycopycode (via GitHub)" <gi...@apache.org> on 2023/12/18 08:59:08 UTC

[I] 执行RegisterMemoryForRdma发生 Segmentation fault (brpc)

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: dev-unsubscribe@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 执行RegisterMemoryForRdma发生 Segmentation fault (brpc)

Posted by "binarycopycode (via GitHub)" <gi...@apache.org>.
binarycopycode commented on issue #2472:
URL: https://github.com/apache/brpc/issues/2472#issuecomment-1859963411

   解决了。需要加上`brpc::rdma::GlobalRdmaInitializeOrDie();`
   不然没有注册g_pd
   ![pd=0](https://github.com/apache/brpc/assets/34117975/79e0ae14-dd2c-4634-8ca9-c135c935370a)
   ![pd != 0](https://github.com/apache/brpc/assets/34117975/b2ffe747-b3ad-462d-ba3b-77abfe40a27e)
   


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 执行RegisterMemoryForRdma发生 Segmentation fault (brpc)

Posted by "binarycopycode (via GitHub)" <gi...@apache.org>.
binarycopycode closed issue #2472: 执行RegisterMemoryForRdma发生 Segmentation fault
URL: https://github.com/apache/brpc/issues/2472


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 执行RegisterMemoryForRdma发生 Segmentation fault (brpc)

Posted by "binarycopycode (via GitHub)" <gi...@apache.org>.
binarycopycode commented on issue #2472:
URL: https://github.com/apache/brpc/issues/2472#issuecomment-1859967178

   感觉文档里可以多补充一些细节


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] 执行RegisterMemoryForRdma发生 Segmentation fault (brpc)

Posted by "binarycopycode (via GitHub)" <gi...@apache.org>.
binarycopycode commented on issue #2472:
URL: https://github.com/apache/brpc/issues/2472#issuecomment-1859841761

   @Tuvie 帮忙看看,谢谢


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org