StackExchange / StackExchange/StackExchange.Redis

ConnectionMultiplexer holding references to 4+ GB memory

Open
#2,307 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.2k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

We have been having a few instances of our machines low on memory so we were doing a bunch of investigations. In one of the investigations, something peculiar showed up which I could not make a whole lot of sense of.

Here is what dotMemory shows for a specific memory dump.

The string problem we have here, we are aware of it and working on fixing (it doesn't concern caching). The concerning part is 4.04 GB retained by ConnectionMultiplexer

image

I tried looking deeper into it. It looks like the Redis SDK holds a long Queue of messages

image

Wanted to understand if this is expected or are we seeing\hitting a bug somewhere, either in the way we are setup OR the way SDK behaves. Also how to interpret this retained memory snapshot in general.

We are using .Net Core 3.1.x Redis caching extension lib which uses StackExchangeRedis 2.0.593

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ConnectionMultiplexer and the queued messages shown in the dotMemory snapshots, using the reported .NET Core 3.1.x and StackExchange.Redis 2.0.593 setup. Compare the retained references with normal client behavior and seek a reproducible workload or memory dump. Done means determining whether the retention is expected or identifying a concrete SDK or configuration bug.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, redis
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.