Closed BenjaminBBr closed 2 months ago
Over the years we have had dozens of similar questions related to using hiredis in a multithreaded environment.
In every case, the issue was due to improper sharing of the redisContext
between threads. Keep in mind that redisContext
is not thread-safe, so you must take great care when using it in a multi-threaded environment.
The only real suggestion I can give you is to use the standard tools to debug such issues such as valgrind
, rr
, or the various compiler sanitizers at your disposal (-fsanitize=thread
, -fsanitize=address
, etc).
Going to close this issue since it's unlikely an issue in hiredis.
If you can provide a reproducer I'm happy to take a look.
My application has a thread and a hireis handle. In some cases, the set command fails, and the reply handle is available, but it does not establish a new connection to continue to use. There are still a large number of set command failures and get command value errors. 1. What circumstances will cause the set command to fail. 2. Is it due to the subsequent value error caused by the continued use of the wrong connection?