Skip to content

Unexpected response when container is near memory limit #2804

Closed

Description

@lazorfuzz

We're seeing the same issue posted here:
#2577

StackExchange.Redis.RedisConnectionException: Unexpected response to HMGET: Integer: 1

Triggered when calling HashGetAsync and when the app is running OOM. App is running on k8s in a container with a mem limit.

StackExchange.Redis version: 2.7.17 on .NET 8, Asp.NET Core application.

Difficult to reproduce, it seems to happen when the application is close to the container mem limit. We see this happen alongside System.OutOfMemoryExceptions.

Additionally, (and much scarier) behavior is we're also occasionally getting the wrong value on GETs in this state. E.g. We check the cache for key:123, but the data we get back is what we expect for key:234. We're not sure if it's the GET returning the wrong data or if the initial SET was setting the wrong data.

Activity

  1. mgravell commented on Oct 18, 2024

    @mgravell
    Member

    Hmm, that is weird. It sounds like a protocol desync has occurred. This is very bad, and I plan to overhaul the IO core soon (prototype is active, etc). However, you could enable "high integrity mode" (see the configuration page, https://stackexchange.github.io/StackExchange.Redis/Configuration.html) - this will both confirm whether desync is the issue, and protect you from incorrect data fetched and all the consequences thereof. If it does report a desync, please let us know!

  2. mgravell commented on Oct 18, 2024

    @mgravell
    Member

    Note that high integrity mode has a slight performance impact, since it adds an additional (tiny) command per operation; in almost all cases, this is effectively invisible and is not a concern.

  3. NickCraver commented on Oct 22, 2024

    @NickCraver
    Collaborator

    Can you also please elaborate on which type of container we're on here? We're assuming Linux from k8s, but which specific container base image? I don't think it'll be relevant but with networking bits, we'd like to know as much about the environment as possible.

  4. lazorfuzz commented on Oct 23, 2024

    @lazorfuzz
    Author

    Yep Linux/containerd. Base image is the standard Ubuntu distro from mcr.microsoft.com/dotnet/aspnet:8.0

  5. mgravell commented on Jul 22, 2026

    @mgravell
    Member

    Thanks for the report. StackExchange.Redis 3.0 ships a substantial rewrite of the low-level IO core — a new RESPite-based stack that replaces Pipelines.Sockets.Unofficial and the old backlog/write loop — and we're confident this issue is addressed by that work.

    Closing as resolved in 3.0. If you can still reproduce on 3.0.x, please comment and we'll reopen and investigate with fresh diagnostics.

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