Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

segmentation fault on exit when auto-reconnect is true #206

Open
kiranpradeep opened this issue Dec 23, 2018 · 0 comments
Open

segmentation fault on exit when auto-reconnect is true #206

kiranpradeep opened this issue Dec 23, 2018 · 0 comments

Comments

@kiranpradeep
Copy link

kiranpradeep commented Dec 23, 2018

Below redis client program seg-faults on exit if redis-server is not available. I killed redis-server after the client started. Call stack from core dump is below.

#include <cpp_redis/cpp_redis>
#include <thread>
#include <chrono>

int main(void) 
{
  cpp_redis::client client;
  client.connect("127.0.0.1", 6379, nullptr, 0, 10, 1000);
  std::this_thread::sleep_for(std::chrono::seconds(5)); // kill redis-server during this sleep
  client.cancel_reconnect();
  return 0;
}

(gdb) bt
#0 0x00007f6f7b23db63 in std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00000000004b2c78 in cpp_redis::sentinel::get_master_addr_by_name(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&, unsigned long&, bool) ()
#2 0x00000000004279f7 in cpp_redis::client::reconnect() ()
#3 0x00000000004268df in cpp_redis::client::connection_disconnection_handler(cpp_redis::network::redis_connection&) ()
#4 0x00000000004be0ab in tacopie::tcp_client::on_read_available(int) ()
#5 0x00000000004bc9cd in std::_Function_handler<void (), tacopie::io_service::process_rd_event(int const&, tacopie::io_service::tracked_socket&)::$_0>::_M_invoke(std::_Any_data const&) ()
#6 0x00000000004c1561 in tacopie::utils::thread_pool::run() ()
#7 0x00007f6f7b1d2733 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8 0x00007f6f7b4a96db in start_thread (arg=0x7f6f7a76c700) at pthread_create.c:463
#9 0x00007f6f7a88e88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant