youngyangyang04 / KVstorageBaseRaft-cpp

【代码随想录知识星球】项目分享-基于Raft的k-v存储数据库🔥
515 stars 102 forks source link

CLion编译完成后在远程主机端运行bin目录下可执行文件报错:段错误 (核心已转储)。 附部分gdb调试信息,求解答 #73

Open fucccx opened 1 month ago

fucccx commented 1 month ago

yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ ls callerMain consumer provider raftCoreRun test.conf yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ cd .. yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp$ ls bin cmake-build-remotedebug docs format.sh main.cpp src tmp cmake-build-debug-remote-host CMakeLists.txt example lib README.md test yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp$ cd bin yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ ls callerMain consumer provider raftCoreRun test.conf yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ ./provider 段错误 (核心已转储) yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ ./consumer 段错误 (核心已转储) yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ ./raftCoreRun 段错误 (核心已转储) yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ ./callerMain 段错误 (核心已转储) yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ vi test.conf yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$

yzz@yzz:~/home/raftKV/KVstorageBaseRaft-cpp/bin$ gdb ./provider GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./provider... (gdb) run Starting program: /home/yzz/home/raftKV/KVstorageBaseRaft-cpp/bin/provider [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) l 24 void GetFriendsList(::google::protobuf::RpcController controller, const ::fixbug::GetFriendsListRequest request, 25 ::fixbug::GetFriendsListResponse response, ::google::protobuf::Closure done) { 26 uint32_t userid = request->userid(); 27 std::vector friendsList = GetFriendsList(userid); 28 response->mutable_result()->set_errcode(0); 29 response->mutable_result()->set_errmsg(""); 30 for (std::string &name : friendsList) { 31 std::string p = response->add_friends(); 32 p = name; 33 } (gdb) bt

0 0x0000000000000000 in ?? ()

1 0x00007ffff7db2223 in ?? () from /lib/x86_64-linux-gnu/libprotobuf.so.17

2 0x00007ffff7db2660 in google::protobuf::internal::InitSCCImpl(google::protobuf::internal::SCCInfoBase*) ()

from /lib/x86_64-linux-gnu/libprotobuf.so.17

3 0x00007ffff7b51455 in google::protobuf::internal::InitSCC (scc=)

at ./google/protobuf/generated_message_util.h:240

4 google::protobuf::(anonymous namespace)::AddDescriptorsImpl (

table=0x7ffff7c90fe0 <descriptor_table_google_2fprotobuf_2fany_2eproto>)
at google/protobuf/generated_message_reflection.cc:2404

5 google::protobuf::internal::AddDescriptors (table=0x7ffff7c90fe0 )

at google/protobuf/generated_message_reflection.cc:2447

6 0x00007ffff7fe0b9a in call_init (l=, argc=argc@entry=1, argv=argv@entry=0x7fffffffe3c8,

env=env@entry=0x7fffffffe3d8) at dl-init.c:72

7 0x00007ffff7fe0ca1 in call_init (env=0x7fffffffe3d8, argv=0x7fffffffe3c8, argc=1, l=) at dl-init.c:30

8 _dl_init (main_map=0x7ffff7ffe190, argc=1, argv=0x7fffffffe3c8, env=0x7fffffffe3d8) at dl-init.c:119

9 0x00007ffff7fd013a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2

10 0x0000000000000001 in ?? ()

11 0x00007fffffffe63c in ?? ()

12 0x0000000000000000 in ?? ()

578223592 commented 1 month ago

@fucccx 看起来像是protobuf不兼容的问题,可以检查下版本