Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

RESP3: ZMPOP closes the connection when a popped score is infinite

Open Beginner friendly
#2,327 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend, databases

Research direction

Start in libs/server/Resp/Objects/SortedSetCommands.cs at SortedSetMPop, around line 511, and compare its RESP3 score handling with the working BZMPOP or ZPOPMIN paths. Reproduce with the supplied RESP3 commands and confirm ZMPOP returns infinite scores as RESP3 doubles instead of closing the connection.

Written by the indexing model from the issue text.

Description

Describe the bug

On RESP3, ZMPOP closes the connection when any popped member has an infinite score. The server logs:

crit: Session[0] [...] ProcessMessages threw an exception: System.FormatException: The input string '-inf' was not in a correct format.
   at System.Double.Parse(ReadOnlySpan`1 utf8Text, NumberStyles style, IFormatProvider provider)
   at Garnet.server.RespServerSession.SortedSetMPop[TGarnetApi](TGarnetApi& storageApi) in /src/libs/server/Resp/Objects/SortedSetCommands.cs:line 511

The cause is in SortedSetMPop, libs/server/Resp/Objects/SortedSetCommands.cs:511:

if (respProtocolVersion >= 3)
{
    WriteDoubleNumeric(double.Parse(score.ReadOnlySpan));
}

Scores are stored as Redis text (inf, -inf), and .NET's double.Parse does not accept that text. RESP2 is not affected, because it writes the stored text unchanged. The other pop and range paths already write RESP3 doubles correctly (,inf): ZRANGE ... WITHSCORES, ZPOPMIN, BZPOPMAX and BZMPOP all work.

Steps to reproduce the bug
HELLO 3
ZADD inf -inf 7 +inf 9            => :2
ZRANGE inf 0 -1 WITHSCORES        => [[7, ,-inf], [9, ,inf]]   (works)
ZMPOP 2 missing inf MIN COUNT 2   => connection closed
Expected behavior

ZMPOP replies [inf, [[7, -inf], [9, inf]]], with the scores as RESP3 doubles ,-inf and ,inf, as Redis does and as BZMPOP already does in Garnet.

Release version

v2.2.5 (ghcr.io/microsoft/garnet:2.2.5, default options). Also reproduced on v2.1.8, on main at 8d00713, and on the head of #2289.

IDE

Not applicable. Commands sent over a raw TCP connection.

OS version

Docker on Windows 11 (Linux container).

Additional context

Found while running the integration suite of Respire, a .NET Redis client, against Garnet. I could not find an existing issue or pull request for this. The other RESP3 paths may have a shared helper that formats the stored score text without double.Parse, which this path could reuse.

Dominant language
C#
Stars
12.1k
Forks
716
Avg merge
1d 21h
Merged PRs (30d)
62

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No 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.

More from microsoft/garnet

All issues in microsoft/garnet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.