sewenew / redis-plus-plus

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

[BUG] socket_timeout parameter has no effect if the link is broken between redis instance and the client. Outage towards a slot range for several minutes. #579

Open jzkiss opened 2 months ago

jzkiss commented 2 months ago

Describe the bug socket_timeout parameter has no effect if the link is broken between redis instance and the client. Outage towards a slot range for several minutes.

To Reproduce

Expected behavior After socket_timeout, redis-plus-plus discover the new elected master / broken connection, traffic is redirected to that master

Unexpected result: old connection is used, continuous TCP packet retransmissions, no response to users for the given slot range for several minutes

Environment: OS: Rocky Linux 8.2-20.el8.0.1 Compiler: gcc version 8.5.0 hiredis version: hiredis 1.2.0 redis-plus-plus version: 1.3.12

Additional context Correction proposal:

As a workaround, we started guard timer and reset the AsyncRedisClient at timeouts to force redis-plus-plus to discover the mastership changes / broken links. But this solution also caused some issues, see: https://github.com/sewenew/redis-plus-plus/issues/577 https://github.com/sewenew/redis-plus-plus/issues/578