这篇主要记录项目中发生的一些相对隐晦的宕机bug,这些bug通常无法通过简单的查看堆栈快速定位问题。这里只是作为一个汇总,并且如果有新的bug会继续更新。每个bug会在连接的文章中做更详细的分析(蓝色部分)
1.#0 0xb7784ca2 in ?? ()(gdb) bt#0 0xb7784ca2 in ?? ()#1 0xb7166687 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56#2 0xb7169ab3 in __GI_abort () at abort.c:89#3 0xb71a0fd3 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0xb72a001c "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175#4 0xb71ab4ca in malloc_printerr (action=, str=0xb72a0110 "double free or corruption (!prev)", ptr=0x90c6418) at malloc.c:4996#5 0xb71ac13d in _int_free (av=0xb72e4420, p=, have_lock=0) at malloc.c:3840#6 0xb739382f in operator delete(void*) () from /usr/lib/i386-linux-gnu/libstdc++.so.6#7 0x08099fb6 in ListServer::Tick (this=0xbff694ac) at main.cpp:139#8 0x080997d7 in appMain (argc=4, argv=0xbff69694) at main.cpp:214#9 0x080998ed in main (argc=4, argv=0xbff69694) at main.cpp:239
2.#0 0xf74c3a74 in ?? () from /lib/i386-linux-gnu/libc.so.6#1 0xf74c49d8 in malloc () from /lib/i386-linux-gnu/libc.so.6#2 0x0894573d in evWatchMalloc (size=512) at ev_memory_watch.cpp:97#3 0x08528896 in operator new (size=512) at main.cpp:55#4 0x085288bc in operator new[] (nSize=512) at main.cpp:66#5 0x089751a6 in google::protobuf::internal::RepeatedPtrFieldBase::Reserve (this=0x298d0420, new_size=65) at google/protobuf/repeated_field.cc:51#6 0x0812c38a in google::protobuf::internal::RepeatedPtrFieldBase::Add::TypeHandler> (this=0x298d0420) at ../../engine/ext_libs/protobuf-2.6.1/src/google/protobuf/repeated_field.h:904#7 0x08126561 in google::protobuf::RepeatedPtrField::Add (this=0x298d0420) at ../../engine/ext_libs/protobuf-2.6.1/src/google/protobuf/repeated_field.h:1124#8 0x08124c56 in PssSave::Save_Copy::add_copies (this=0x298d0410) at ../protocol/saveload/save_copy.pb.h:630#9 0x0810fc3f in CCopySystem::_OnPlayerSave (this=0xb7250f0, player=..., _msg=0x298e38f0, mem_data=0x175f9088) at gs_copy/gs_copy.cpp:561#10 0x08135e4e in std::_Mem_fn::operator()(CCopySystem*, CPlayer&, PssSave::SaveData*&&, EvMemoryStream*&&) const (this=0xd6342f8, __object=0xb7250f0) at /usr/include/c++/4.8/functional:601
指针在MemoryStream扩充时变成了无效地址,继续修改指针位置的值时破坏了系统内存,在后续分配内存时发生错误
3.#0 0x080a7a0e in std::_Rb_tree, std::_Select1st>, std::less, std::allocator> >::_M_begin (this=0x0) at /usr/include/c++/4.8/bits/stl_tree.h:508#1 0x080a63cb in std::_Rb_tree, std::_Select1st>, std::less, std::allocator> >::find (this=0x0, __k=...) at /usr/include/c++/4.8/bits/stl_tree.h:1805#2 0x080a1fbd in std::map, std::allocator > >::find (this=0x0, __x=...) at /usr/include/c++/4.8/bits/stl_map.h:837
#3 0x08098b46 in GDict::find (this=0x0, key=0x81419cc "_id") at util/gs_dict.cpp:1503
#4 0x08081cc4 in GDict::sure (this=0x0, key=0x81419cc "_id") at sdk/gs_dict.h:255
#5 0x08080dcf in RoleCacheMgr::UpdateCache (this=0x9252e60, connect_id=1, token_num=5856851) at role_cache.cpp:271
#6 0x0805324c in MysqlDriver::MyQueryUpdate (this=0x92518d8, p_db_cmd=0xb954f20, result_ptr=0xa9e79f0) at database/mysql/mysql_driver.cpp:2410
#7 0x0804fe28 in MysqlDriver::ProcessCommand (this=0x92518d8, p_cmd=0xb954f20) at database/mysql/mysql_driver.cpp:832
#8 0x0806e5df in WorkThread::ProcessCommand (this=0x9261060, pp_commands=0x9290a78, count=1) at database/database.cpp:477
#9 0x0806e1f2 in WorkThread::OnRun (this=0x9261060) at database/database.cpp:384
#10 0x080f6a78 in EvThread::ThreadProc (args=0x9260288) at ev_thread.cpp:103
#11 0xf7771f72 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#12 0xf72353ee in clone () from /lib/i386-linux-gnu/libc.so.6
网友评论