Closed plainbanana closed 2 weeks ago
In my humble opinion, it might be better not to initiate a new connection in (5) if
redisClusterAsyncDisconnect
has already been issued.
Yes, it sounds reasonable that hiredis-cluster shouldn't initiate new connections when a user wants to disconnect.
When disconnecting the flag REDIS_DISCONNECTING
is set in hiredis
which blocks new commands on existing nodes.
But we should probably add a similar flag in hiredis-cluster to avoid creating new connections to nodes.
Closed by #225
Hello hiredis-cluster team,
We have encountered a situation where the event loop hangs after issuing
redisClusterAsyncDisconnect
in conditions where connection errors are likely to occur.Here is a reproducible example on the current master branch. The program hangs only when
.heavyoperation
is set totrue
. Sorry for the rough example. https://gist.github.com/plainbanana/0f287c6afec4527dba566d01e98aca63I may be wrong, but I have looked into possible causes:
debug sleep 1
added inredisClusterAsyncCommandToNode
timed out.updateSlotMapAsync
, adding aCLUSTER NODES
command.sleep 1
) was executed in thecommandCallback
.redisClusterAsyncDisconnect
was executed in thecommandCallback
.CLUSTER NODES
command (?), a retry was attempted inclusterNodesReplyCallback
, which established a new connection and added anotherCLUSTER NODES
command.redisProcessCallbacks
did not recognizeREDIS_DISCONNECTING
, leading to a hang.Is there a way to avoid the hang and successfully terminate the connections in such a scenario? In my humble opinion, it might be better not to initiate a new connection in (5) if
redisClusterAsyncDisconnect
has already been issued. I would appreciate your input.Thank you.