You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2021/07/09 05:30:55 UTC

[GitHub] [incubator-brpc] jvfan opened a new issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

jvfan opened a new issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470


   **Describe the bug (描述bug)**
   WSL2-Ubuntu20.04 下编译 bRPC 的示例 echo_c++ 成功,运行时报异常 src/tcmalloc.cc:332] Attempt to free invalid pointer;
   
   ![image](https://user-images.githubusercontent.com/31410192/125027382-bded9380-e0b8-11eb-8fc0-f0bd5228f134.png)
   
   **To Reproduce (复现方法)**
   1. 安装 openssl、snappy、google-perftools、gtest
       默认会安装 libxxx 到 /usr/local/lib 目录;
       ```
       sudo apt-get install -y libsnappy-dev
       sudo apt-get install -y libgoogle-perftools-dev
       sudo apt-get install -y libgtest-dev
       ```
   2. 手动源码编译一些库 openssl 1.1.1k、gflags、protobuf、leveldb
       全部安装 libxxx 到 /usr/local 目录,已经验证 protobuf 完全正常;
   3. 添加 /usr/local/bin 到环境变量,并确保了以下条件
       –/usr/include 目录中至少存在:
       * openssl/ssl.h
       * gflags/gflags.h
       * leveldb/db.h
   
       –/usr/local/lib 目录至少存在:
       * openssl 动态库
       * gflags 动态库
       * protobuf
       * leveldb 动态库
   4. 执行 brpc 编译脚本如下:
       ```
       sh config_brpc.sh --headers=/usr/include --libs=/usr/local/lib
       make
       ```
   5. 进入 example/echo_c++ 目录编译
       以下是 Makefile 方式编译,cmake 方式也试过;
       ```
       cd example/echo_c++
       make
       ```
   7. 运行 echo_server
       ```
       ./echo_server
       ```
       ```
       ./echo_client
       ```
   
   **Expected behavior (期望行为)**
   echo_server 正常运行;
   echo_client 正常运行;
   
   **Versions (各种版本)**
   OS: WIN11-WSLg-Ubuntu20.04
   Compiler: g++ 9.3.0
   brpc: 0.9.7
   protobuf: 3.17.3
   
   **Additional context/screenshots (更多上下文/截图)**
   
   ```
   ➜  echo_c++ make clean
   Cleaning
   ➜  echo_c++ make
   Generating echo.pb.cc
   Compiling echo.pb.o
   Compiling client.o
   Linking echo_client
   Compiling server.o
   In file included from ../../output/include/butil/resource_pool.h:89,
                    from ../../output/include/brpc/socket.h:30,
                    from ../../output/include/brpc/redis.h:32,
                    from ../../output/include/brpc/server.h:43,
                    from server.cpp:22:
   ../../output/include/butil/resource_pool_inl.h: In instantiation of ‘static butil::ResourcePool<T>* butil::ResourcePool<T>::singleton() [with T = brpc::Socket]’:
   ../../output/include/butil/resource_pool.h:118:38:   required from ‘int butil::return_resource(butil::ResourceId<T>) [with T = brpc::Socket]’
   ../../output/include/brpc/socket_inl.h:112:51:   required from here
   ../../output/include/butil/resource_pool_inl.h:368:17: warning: ‘new’ of type ‘butil::ResourcePool<brpc::Socket>’ with extended alignment 64 [-Waligned-new=]
     368 |             p = new ResourcePool();
         |                 ^~~~~~~~~~~~~~~~~~
   ../../output/include/butil/resource_pool_inl.h:368:17: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
   ../../output/include/butil/resource_pool_inl.h:368:17: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
   Linking echo_server
   rm echo.pb.cc
   ➜  echo_c++
   ➜  echo_c++ ./echo_server
   src/tcmalloc.cc:332] Attempt to free invalid pointer 0x5628779b1200
   [1]    28488 abort      ./echo_server
   ➜  echo_c++
   ➜  echo_c++ ./echo_client
   src/tcmalloc.cc:332] Attempt to free invalid pointer 0x563ada41e200
   [1]    28495 abort      ./echo_client
   ➜  echo_c++
   ```
   


-- 
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


[GitHub] [incubator-brpc] TousakaRin edited a comment on issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

Posted by GitBox <gi...@apache.org>.
TousakaRin edited a comment on issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470#issuecomment-877053969


   > > 有可能是因为这个: [gperftools/gperftools#1066](https://github.com/gperftools/gperftools/issues/1066) ,尝试静态连接perftools看看(最简单的办法就是将目录里的.so移动到其他地方,只保留同名的.a文件)
   > > clean的时候brpc和example都需要clean
   > 
   > 我尝试了一点,给示例 echo_c++ 的 CMakeLists.txt 加上了 tcmalloc 依赖后就不会段错误了,请问这是为什么?
   > 
   
   可以看看cmake出来的Makefile,和已经有的Makefile有什么区别


-- 
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


[GitHub] [incubator-brpc] jvfan commented on issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

Posted by GitBox <gi...@apache.org>.
jvfan commented on issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470#issuecomment-876977537


   > 1. perftools 版本是多少?
   > 2. 具体的堆栈?
   
   google-perftools 版本是 2.9.1,github 最新版,刚刚编译安装了一遍源码,brpc 也重新 clean 过,结果还是一样的结果,会段错误;
   另外请问堆栈怎么看?


-- 
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


[GitHub] [incubator-brpc] TousakaRin commented on issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

Posted by GitBox <gi...@apache.org>.
TousakaRin commented on issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470#issuecomment-877053969


   > > 有可能是因为这个: [gperftools/gperftools#1066](https://github.com/gperftools/gperftools/issues/1066) ,尝试静态连接perftools看看(最简单的办法就是将目录里的.so移动到其他地方,只保留同名的.a文件)
   > > clean的时候brpc和example都需要clean
   > 
   > 我尝试了一点,给示例 echo_c++ 的 CMakeLists.txt 加上了 tcmalloc 依赖后就不会段错误了,请问这是为什么?
   > 
   > ![image](https://user-images.githubusercontent.com/31410192/125042365-517c8f80-e0cc-11eb-8bf4-a52e5883b5d4.png)
   
   可以看看cmake出来的Makefile,和已经有的Makefile有什么区别


-- 
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


[GitHub] [incubator-brpc] jvfan edited a comment on issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

Posted by GitBox <gi...@apache.org>.
jvfan edited a comment on issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470#issuecomment-876985533


   > 有可能是因为这个: [gperftools/gperftools#1066](https://github.com/gperftools/gperftools/issues/1066) ,尝试静态连接perftools看看(最简单的办法就是将目录里的.so移动到其他地方,只保留同名的.a文件)
   > 
   > clean的时候brpc和example都需要clean
   
   我尝试了一点,给示例 echo_c++ 的 CMakeLists.txt 加上了 tcmalloc 依赖后就不会段错误了,请问这是为什么?
   
   ![image](https://user-images.githubusercontent.com/31410192/125042365-517c8f80-e0cc-11eb-8bf4-a52e5883b5d4.png)
   


-- 
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


[GitHub] [incubator-brpc] jvfan commented on issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

Posted by GitBox <gi...@apache.org>.
jvfan commented on issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470#issuecomment-876985533


   > 有可能是因为这个: [gperftools/gperftools#1066](https://github.com/gperftools/gperftools/issues/1066) ,尝试静态连接perftools看看(最简单的办法就是将目录里的.so移动到其他地方,只保留同名的.a文件)
   > 
   > clean的时候brpc和example都需要clean
   
   我尝试了一点,给示例 echo_c++ 的 CMakeLists.txt 加上了 tcmalloc 依赖后就不会段错误了,请问这是为什么?
   ![image](https://user-images.githubusercontent.com/31410192/125042365-517c8f80-e0cc-11eb-8bf4-a52e5883b5d4.png)
   


-- 
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


[GitHub] [incubator-brpc] serverglen commented on issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

Posted by GitBox <gi...@apache.org>.
serverglen commented on issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470#issuecomment-876944756


   1. perftools 版本是多少?
   2. 具体的堆栈?


-- 
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


[GitHub] [incubator-brpc] TousakaRin commented on issue #1470: WSL2-Ubuntu20.04 下运行示例 echo_c++ 结果段错误

Posted by GitBox <gi...@apache.org>.
TousakaRin commented on issue #1470:
URL: https://github.com/apache/incubator-brpc/issues/1470#issuecomment-876979066


   有可能是因为这个: https://github.com/gperftools/gperftools/issues/1066 ,尝试静态连接perftools看看(最简单的办法就是将目录里的.so移动到其他地方,只保留同名的.a文件)
   
   clean的时候brpc和example都需要clean
   


-- 
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