-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconnection #21
Comments
I've found a temporary solution. Each time a disconnection happens, I build a redox object in order to try to establish a new connection. std::shared_ptr<redox::Redox> conn = std::make_shared<redox::Redox>(/* some configuration */);
conn->connect("127.0.0.1", 6379, state_changed_callback); Then, when a disconnection is detected and state_changed_callback is called, I simply make: conn->disconnect();
conn = std::make_shared<redox::Redox>(/* some configuration */);
conn->connect("127.0.0.1", 6379, state_changed_callback); This works like a charm with the redox client. However, it is broken for the redox subscriber client. If I call redox::Subscriber::disconnect, it results in a segfault with a backtrace similar to the one posted in the first post. So I only rebuild a new subscriber instance without calling This is a quite bad situation concerning the subscriber since nothing is freed in the redox::Subscriber destructor (unlike in the redox client), so it may be a possible source of memory leaks. |
Hi Cylix, I agree that disconnection/reconnection is the biggest outstanding issue for Redox. I've been frustrated by the strange things hiredis tends to do. Definitely would like to take another smack at it when I get a chance. |
Hello, Is there some fixes already for that problem ? I would like to implement Redox to my production app. |
I currently use a simple solution in my application (it is working in production). Not really elegant but it works. |
Okay thank you, I've seen your library but probably I will use this one. Is it possible to check if Redox is connected to the redis before calling some command ? Or I should just setup the disconnection hanlder. |
Heya, I've setup the handler, everything works but now also experiencing the problem with the subscribe. I just have to create new object without disonnection. |
Hi
I'd like to know how to handle reconnection with your library?
I'm currenlty setting the connection handler and I'd like to try to reconnect to the redis server in case of unexpected disconnection.
For that, I've tried to first call
redox::disconnect()
and thenredox::connect
, but the program abort in theredox::connect
because the event loop thread has not been joined (when the event_loop thread is reset in theredox::connect
, the previous thread is destroyed without having being joined before).But even if I join the thread in the
disconnect
method, my program crashes with a segfault.Here is a backtrace:
What shall we do if we want to reconnect? Build a new Redox object? Or calling specific methods that does the work?
The text was updated successfully, but these errors were encountered: