Skip to content
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

Disconnect behavior broken after revamping .free() #10

Open
hmartiro opened this issue Jan 28, 2015 · 6 comments
Open

Disconnect behavior broken after revamping .free() #10

hmartiro opened this issue Jan 28, 2015 · 6 comments
Assignees
Labels

Comments

@hmartiro
Copy link
Owner

Can get segfaults if the server goes down while running commands. Get back to the previous behavior, where the disconnect callback is invoked.

@hmartiro hmartiro added the bug label Jan 28, 2015
@yaqwsx
Copy link

yaqwsx commented Jun 18, 2015

Is this bug going to be fixed soon? It stops me from using this library in my project.

@hmartiro
Copy link
Owner Author

Hi there. Can you help and post the simplest program you can make that demonstrates this behavior?

@yaqwsx
Copy link

yaqwsx commented Jun 21, 2015

Here it is:

#include <redox.hpp>
#include <iostream>
#include <thread>
#include <chrono>

int main()
{
    redox::Redox connection;

    if(!connection.connect("localhost")) {
        std::cout << "Cannot connect!\n";
        exit(1);
    }

    while(true) {
        redox::Command<std::string>& c = connection.commandSync<std::string>({"BLPOP", "key", "0"});
        // If the redis-server stops, command fails
        if (!c.ok()) {
            std::cout << "Command failed!\n";
            // It is also impossible to reconnect here (SIGSEGV)
            // If I want to reconnect I have to create new Redox object
            // while(!connection.connect("localhost")) {
            //      std::this_thread::sleep_for(std::chrono::seconds(5));
            // }
        }
        else {
            std::cout << "Reply: " << c.reply() << std::endl;
        }

        // When I try to free failed command, I get SIGSEGV, when I don't
        // free failed command, I get warning from Redox to stdout
        // "Not all commands were freed"
        c.free();
        std::cout << "Done\n";
    }
}

@hmartiro hmartiro self-assigned this Jun 21, 2015
@hmartiro
Copy link
Owner Author

Thank you. I will try to find time to investigate this. I have frustrations with disconnect interactions with hiredis.

@shikharkhattar
Copy link

Facing the same issue. Is there a workaround ?

@bspguy
Copy link
Collaborator

bspguy commented Apr 16, 2017

Hi all
Please upgrade hiredis and libev to latest versions.
Once these are upgraded, I was not able to reproduce this issue.
(working with redis 3.2.6 on fedora)

Please let me know if you are still facing problems.

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

No branches or pull requests

4 participants