Skip to content

Sudden multi-key operations RedisCommandExceptions on a standalone/non-clustered Azure Managed Redis #3284

Closed

Description

@vladislav-karamfilov

After #3274 being fixed in v3.4.5 we upgraded on Tuesday and it worked like a charm for ~ 24 hours but at some point yesterday we started getting RedisConnectionException like this one:

StackExchange.Redis.RedisConnectionException: SocketClosed on XXX.northcentralus.redis.azure.net:10000/Subscription, Idle/RanToCompletion, last: PING, origin: ReadAllAsync, outstanding: 1, last-read: 0s ago, last-write: 0s ago, unanswered-write: 0s ago, keep-alive: 60s, state: ConnectedEstablished, in: 0, in-pipe: 0, last-heartbeat: 0s ago, last-mbeat: 0s ago, global: 0s ago, v: 3.4.5.54687

which we thought are related to an Azure internal resource maintenance event. Some time after that we started getting RedisCommandException for multi-key operations but we are using a non-clustered Azure Managed Redis resource which shouldn't trigger these:

StackExchange.Redis.RedisCommandException: Multi-key operations must involve a single slot; keys can use 'hash tags' to help this, i.e. '{/users/12345}/account' and '{/users/12345}/contacts' will always be in the same slot
   at StackExchange.Redis.ConnectionMultiplexer.SelectServer(Message message) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 2532
   at StackExchange.Redis.RedisTransaction.ExecuteAsync(CommandFlags flags) in /_/src/StackExchange.Redis/RedisTransaction.cs:line 89
   ...

Reverting back to v3.3.1 fixed the issue and it's all OK now (still observing for exceptions though)

Activity

  1. mgravell commented on Oct 22, 2026

    @mgravell
    Collaborator

    Ok, I suspect these are unrelated. The first could relate to maintenance - the interesting question to me is: did it recover?

    The second: that's super interesting - there is a relevant CLUSTER mode change, but it shouldn't incorrectly identify between standalone and regular.

    Is there any chance you'd be willing to run the ExportConfiguration method on the failing version, and let me know what files come back in the zip? Or at least let me know whether it is still reliably reprocible with that version?

  2. vladislav-karamfilov commented on Oct 22, 2026

    @vladislav-karamfilov
    Author
    1. Ok, I suspect these are unrelated. The first could relate to maintenance - the interesting question to me is: did it recover?

    Yes, RedisConnectionExceptions were thrown for only ~40 minutes yesterday.

    The second: that's super interesting - there is a relevant CLUSTER mode change, but it shouldn't incorrectly identify between standalone and regular.
    Is there any chance you'd be willing to run the ExportConfiguration method on the failing version, and let me know what files come back in the zip? Or at least let me know whether it is still reliably reprocible with that version?

    I have deployed the app with v3.4.5 and the issue isn't reproducible at the moment. Reverting back to v3.3.1 though because I don't want to risk it failing during the work hours of our US clients.

  3. mgravell commented on Oct 22, 2026

    @mgravell
    Collaborator

    ~40 minutes would sound like a "nope" to me - I'd expect recovery to happen within seconds, minutes on a bad day. I wonder whether I can auto-enable some better health checks (we have the full health check suite from geo-failover at our fingers)

    On the cluster/routing problem: I'm investigating a hypothesis that HELLO 3 reported the mode as cluster during some kind of internal migration event. That by itself IMO isn't sufficient to work usefully as a cluster, so I'm testing a change whereby we only switch to cluster mode following a successful CLUSTER NODES and/or CLUSTER SLOTS.

    Maybe @philon-msft can opine on the AMR maintenance internals to see what really happens under the hood here, but I'm going to progress that HELLO hypothesis in isolation. In particular, I think there's some interaction between RESP3, pub/sub connections, HELLO, and confusing "cluster" reports; until very recently, RESP3+pub/sub connections wasn't a thing, as we shared the connection for both scenarios.

  4. mgravell commented on Oct 22, 2026

    @mgravell
    Collaborator

    fixed by #3285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions