drogonframework / drogonframework/drogon
connect Redis,出现了double free
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 15
Description
极高概率出现此种异常
产生原因:在配置文件里面配置redis的连接,然后再在main里面初始化的时候再去进行主动连接
drogon::app().createDbClient("mysql", "127.0.0.1", 3306, "test", "root", "123456", 4);
drogon::app().createRedisClient("127.0.0.1", 6379, "test", "123456", 4);
下面是堆栈日志:
#1 0x00007ffff6fc2859 in __GI_abort () at abort.c:79
#2 0x00007ffff702d266 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7157298 "%s\n") at ../sysdeps/posix/libc_fatal.c:156
#3 0x00007ffff70352fc in malloc_printerr (str=str@entry=0x7ffff71595d0 "free(): double free detected in tcache 2") at malloc.c:5347
#4 0x00007ffff7036f6d in _int_free (av=0x7fffb4000020, p=0x7fffb4002a90, have_lock=0) at malloc.c:4201
#5 0x00007ffff74e81ac in ?? () from /lib/x86_64-linux-gnu/libhiredis.so.0.14
#6 0x0000555555b08cbf in drogon::nosql::RedisConnection::~RedisConnection() ()
#7 0x0000555555b171f8 in void __gnu_cxx::new_allocator::destroy(drogon::nosql::RedisConnection*) ()
#8 0x0000555555b1708b in void std::allocator_traits >::destroy(std::allocator&, drogon::nosql::RedisConnection*) ()
#9 0x0000555555b16d2d in std::_Sp_counted_ptr_inplace, (__gnu_cxx::_Lock_policy)2>::_M_dispose() ()
#10 0x00005555555d0c6c in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() ()
#11 0x00005555555cf6b9 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() ()
#12 0x0000555555b09352 in std::__shared_ptr::~__shared_ptr() ()
#13 0x0000555555b09372 in std::shared_ptr::~shared_ptr() ()
#14 0x0000555555b25346 in drogon::nosql::RedisConnection::disconnect()::{lambda()#1}::~disconnect() ()
#15 0x0000555555b2876c in std::_Function_base::_Base_manager::_M_destroy(std::_Any_data&, std::integral_constant) ()
#16 0x0000555555b2780a in std::_Function_base::_Base_manager::_M_manager(std::_Any_data&, std::_Function_base::_Base_manager const&, std::_Manager_operation) ()
#17 0x00005555555cb981 in std::_Function_base::~_Function_base() ()
#18 0x00005555555e8e32 in std::function::~function() ()
#19 0x000055555597378a in std::function::operator=(std::function&&) ()
#20 0x0000555555b629c6 in trantor::MpscQueue >::dequeue(std::function&) ()
#21 0x0000555555b61bfd in trantor::EventLoop::doRunInLoopFuncs() ()
#22 0x0000555555b61111 in trantor::EventLoop::loop() ()
#23 0x0000555555b643fd in trantor::EventLoopThread::loopFuncs() ()
#24 0x0000555555b63ed7 in trantor::EventLoopThread::EventLoopThread(std::__cxx11::basic_string, std::allocator > const&)::{lambda()#1}::operator()() const ()
#25 0x0000555555b64f63 in void std::__invoke_impl, std::allocator > const&)::{lambda()#1}>(std::__invoke_other, trantor::EventLoopThread::EventLoopThread(std::__cxx11::basic_string, std::allocator > const&)::{lambda()#1}&&) ()
Contributor guide
Assessment
This issue has not been assessed yet.