Closed Kilowhisky closed 1 year ago
I believe the issue occurs because of this https://github.com/StackExchange/StackExchange.Redis/blob/f6171a19a0be078c6528b4631d42dfa4adcc8564/src/StackExchange.Redis/ServerSelectionStrategy.cs#L168-L175
Redis servers connected using the Sentinel have a ServerType
of Standalone
. Which means TryResend
always fails.
There probably needs to be a new ServerType
of SentinelMember
or something.
You're correct this wouldn't work - we won't try re-sending across different endpoints. This, in a race, can have very unintended and impossible to debug consequences, so we fail to the user and let them retry if wanted.
Overall, it's probably doubtful we'll add much more support (if any) for Sentinel behaviors because they are so complex, layered, and require more instances. The last I'm aware, Redis itself isn't developing this any further either, with cluster being the intended path going forward. Apologies this isn't working, but the complexity involved to support it already has a high cost. Changing how this works (it swaps out the endpoint entirely on a connection shift today) is a huge change we're just unlikely to make.
Closing this out to tidy up
@NickCraver do you have any sources for your statement about Sentinel no longer being actively developed by Redis? I can't seem to find anything about that. We're about to start implementing HA in Redis and were seriously looking at Sentinel due to the ease of configuration. We also heavily use the StackExchange.Redis library and this bug is unfortunate. Does this same thing happen when using their cluster type of HA? Is that fully supported by StackExchange.Redis?
I am trying to use StackExchange.Redis with Redis Sentinel in a HA environment.
I've encountered a scenario where the outgoing message queue is not transferred to the new primary. This causes all messages in that queue to eventually timeout with the following...
At the exact time of the error, this is the status of the Multiplexer: It clearly shows that there is a connected master ready and waiting to accept the message.
All my writes have the
DemandMaster
flag set.Here is my configuration:
I'm having to manually reconfigure the connection due to this issue: https://github.com/StackExchange/StackExchange.Redis/issues/2487
Here is my reconfiguration code: