Giter Club home page Giter Club logo

Comments (6)

Cylix avatar Cylix commented on July 17, 2024 1

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.
In code, in gives me something like:

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 disconnect on the old one each time a subscriber is disconnected.

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.

from redox.

hmartiro avatar hmartiro commented on July 17, 2024

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.

from redox.

gunzino avatar gunzino commented on July 17, 2024

Hello,

Is there some fixes already for that problem ? I would like to implement Redox to my production app.

from redox.

Cylix avatar Cylix commented on July 17, 2024

I currently use a simple solution in my application (it is working in production).
If I want to reconnect, I simply close the previous connection and try to connect with a new redox client object.

Not really elegant but it works.

from redox.

gunzino avatar gunzino commented on July 17, 2024

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.

from redox.

gunzino avatar gunzino commented on July 17, 2024

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.

from redox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.