StackExchange / StackExchange/StackExchange.Redis

Timeout performing SCAN (10000ms), next: SCAN

Open
#2,662 3 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

I'm trying to remove some keys by prefix.

How am I doing:

public override async Task RemoveByPrefixAsync(string prefix, params object[] prefixParameters)

{

  prefix = PrepareKeyPrefix(prefix, prefixParameters);

  foreach (var endPoint in _connectionWrapper.GetEndPoints())
  {
      var keys = GetKeys(endPoint, prefix);

      _db.KeyDelete(keys.ToArray());
  }
  await RemoveByPrefixInstanceDataAsync(prefix);

}

and here the error I'm taking:
Timeout performing SCAN (10000ms), inst: 101, qu: 0, qs: 0, aw: False, rs: ReadAsync, ws: Idle, in: 0, in-pipe: 0, out-pipe: 0, serverEndpoint: xx.xx.x.xx:xxx, mc: 1/1/0, mgr: 10 of 10 available, clientName: api, IOCP: (Busy=0,Free=1000,Min=12,Max=1000), WORKER: (Busy=3,Free=32764,Min=12,Max=32767), v: 2.2.88.56325 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)", "detalhes": "InnerException: ---- StackTrace: at StackExchange.Redis.CursorEnumerable1.Enumerator.ThrowTimeout(Message message) in /_/src/StackExchange.Redis/CursorEnumerable.cs:line 244\n at StackExchange.Redis.CursorEnumerable1.Enumerator.SlowNextSync() in /_/src/StackExchange.Redis/CursorEnumerable.cs:line 191\n at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable1 items)\n at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)\n

Has anyone experienced this and if so how did you resolve it?
Any idea?

Thanks!

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 RemoveByPrefixAsync and the GetKeys call shown in the issue, then read CursorEnumerable.cs around lines 191 and 244 where the timeout is reported. Review the linked StackExchange.Redis timeout guidance and reproduce the SCAN behavior if possible. Done means identifying the cause of the 10-second SCAN timeout and documenting a supported resolution.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.