redis-plus-plus
redis-plus-plus copied to clipboard
[BUG] coredump happened in case connect_callback with exception for async mode
Describe the bug
in AsyncConnection::connect_callback, there throw error during handle different state, my case is throw error during State::CONNECTING, then program fire SegV.
To Reproduce To simple reproduce, you can use TLS, provide CA file which didn't exist, then , core dump will happen
Expected behavior Program shouldn't crash.
Environment:
- OS: [e.g. ubuntu]
- Compiler: [e.g. gcc 7.3.1, clang 3.9.1]
- hiredis version: [e.g. v1.0.0, master]
- redis-plus-plus version: [e.g. 1.3.2, master, commit b0a42e]
Additional context I think it is a multiple thread issues. AsyncConnection::connect_callback, handle exception via AsyncConnection::disconnect, then redisAsyncContext is freed. While, it seems libuv still not aware of context invalid, and still try to access, then segV.
bt
#0 0x00007f1a8a28799e in redisAsyncHandleWrite (ac=0x7f1a8000dee0) at async.c:687
#1 0x00007f1a884f6f2b in uv__io_poll (loop=loop@entry=0x153e100, timeout=
Below shown details, c->funcs had been invalid.
p *(redisAsyncContext *)ac $3 = {c = {funcs = 0xffffffffffffffff, err = -1,...
All in all, redis-plus-plus seems is not thread safe when interact with libuv at rainy cases.