sewenew / redis-plus-plus

Redis client written in C++
Apache License 2.0
1.6k stars 347 forks source link

A null status reply #505

Closed taoxulong closed 1 year ago

taoxulong commented 1 year ago

Describe the problem A clear and concise description of the problem, with minimal code to reproduce the problem.

Environment:

question: sw::redis::cmd::auth (connection=..., password=...) at /home/ofcs/app/src/billing/redis-plus-plus/src/sw/redis++/command.h:37 37 char auths[64] = {'\0'}; (gdb) n 38 sprintf(auths, "AUTH %s", password.data()); (gdb) 39 connection.send(auths); (gdb) p auths $8 = "AUTH abcfffff!", '\000' <repeats 48 times> (gdb) n 41 } (gdb) sw::redis::Connection::_auth (this=0x7fffffffd6a0) at /home/ofcs/app/src/billing/redis-plus-plus/src/sw/redis++/connection.cpp:314 314 auto reply = recv(); (gdb) 316 assert(reply); (gdb) p reply $9 = { _M_t = {<std::_Tuple_impl<0ul, redisReply, sw::redis::ReplyDeleter>> = {<std::_Tuple_impl<1ul, sw::redis::ReplyDeleter>> = {<std::_Head_base<1ul, sw::redis::ReplyDeleter, true>> = { = {}, }, }, <std::_Head_base<0ul, redisReply, false>> = {_M_head_impl = 0x6f6760}, }, }} (gdb) p reply $10 = (redisReply &) @0x6f6760: {type = 5, integer = 0, dval = 9.8813129168249309e-324, len = 6924672, str = 0x0, vtype = "\000\000\000", elements = 0, element = 0x71} (gdb) n 318 reply::parse(reply); (gdb)

        auth xxxx

       catch ---   A null status reply 

code: sw::redis::ConnectionOptions connection_options; connection_options.host = "127.0.0.1"; // Required. connection_options.port = 6000; // Optional. The default port is 6379. connection_options.password = "1234dx!"; // Optional. No password by default. connection_options.db = 0; // Optional. Use the 0th database by default.

    sw::redis::ConnectionPoolOptions pool_options;
    pool_options.size = 5;  // Pool size, i.e. max number of connections.
    pool_options.wait_timeout = std::chrono::milliseconds(100);

    sw::redis::RedisCluster* redisofDB1 = NULL;
    try {
        redisofDB1 = new sw::redis::RedisCluster(connection_options, pool_options);
            }
            catch (const sw::redis::Error& err) {
        printf("RedisHandler-- other:%s \n", err.what());
        return ;
    }
sewenew commented 1 year ago

Not reproducible.