You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 6, 2019. It is now read-only.
Hello,
I need to request a redis db containing sets.
I think there is a problem with smembers and its return values :
std::vector<int> el; client.smembers(key), [&] (cpp_redis::reply& reply) { std::vector<cpp_redis::reply> rep = reply.as_array(); for (auto it = rep.begin(); it != rep.end(); it++){ el.push_back(std::stoi(it->as_string())); } }); client.commit();
I get pieces of the good answer and then segfault or memory error if i use this code. But if I put a sleep(1) before (or after) client.commit(); it's ok.
So I think the problem is the client is not reading returned values as far as they're sent. I can't use a sleep(1) because of my application.
Have you ever experienced that ? Thank you for your help.
The text was updated successfully, but these errors were encountered:
Unfortunately, I can't reproduce the bug on my machines.
Considering the fact that adding a sleep(1) seems to solve your problem, would it be possible that your program terminates while the different callbacks are executed?
In the examples, I used a while (not should_exit) loop: do you have a construct that allow you to avoid the destruction of the redis_client while there are still callback being processed?
If not, is there any way you could provide a valgrind report or gdb backtrace that could help me localize the problem? I'll keep trying to reproduce the error but it would help me a lot.
Hello,
I need to request a redis db containing sets.
I think there is a problem with smembers and its return values :
std::vector<int> el; client.smembers(key), [&] (cpp_redis::reply& reply) { std::vector<cpp_redis::reply> rep = reply.as_array(); for (auto it = rep.begin(); it != rep.end(); it++){ el.push_back(std::stoi(it->as_string())); } }); client.commit();
I get pieces of the good answer and then segfault or memory error if i use this code. But if I put a sleep(1) before (or after) client.commit(); it's ok.
So I think the problem is the client is not reading returned values as far as they're sent. I can't use a sleep(1) because of my application.
Have you ever experienced that ? Thank you for your help.
The text was updated successfully, but these errors were encountered: