Skip to content

Fix wrong argv index in xinfoReplyWithStreamInfo for slot alloc size tracking#15037

Merged
sundb merged 1 commit intoredis:unstablefrom
sundb:fix-xinfo-stream-wrong-argv-index
Apr 14, 2026
Merged

Fix wrong argv index in xinfoReplyWithStreamInfo for slot alloc size tracking#15037
sundb merged 1 commit intoredis:unstablefrom
sundb:fix-xinfo-stream-wrong-argv-index

Conversation

@sundb
Copy link
Copy Markdown
Collaborator

@sundb sundb commented Apr 13, 2026

xinfoReplyWithStreamInfo passed the wrong key(c->argv[1]) instead of c->argv[2] to updateSlotAllocSize when updating per-slot memory tracking.

Fix by passing the key explicitly to xinfoReplyWithStreamInfo instead of relying on a hardcoded argv index.
Also, add the -DDEBUG_ASSERTIONS flag to the test-ubuntu-jemalloc CI to cover this debug assertion.

The xinfo command argv layout is:

  • argv[0] = "xinfo"
  • argv[1] = subcommand ("stream", "groups", "consumers")
  • argv[2] = key

Note

Medium Risk
Touches per-slot memory tracking for XINFO STREAM, which can affect cluster slot memory accounting/metrics if incorrect, but the change is small and localized. CI build flags are expanded to run additional debug assertions that may surface new failures.

Overview
Fixes XINFO STREAM per-slot memory tracking by passing the actual stream key into xinfoReplyWithStreamInfo and using it (instead of a hardcoded argv index) when calling updateSlotAllocSize.

Updates the test-ubuntu-jemalloc Daily CI job to compile with -DDEBUG_ASSERTIONS to exercise related debug checks during tests.

Reviewed by Cursor Bugbot for commit dde5f89. Bugbot is set up for automated code reviews on this repo. Configure here.

@sundb sundb added the release-notes indication that this issue needs to be mentioned in the release notes label Apr 13, 2026
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Apr 13, 2026

🤖 Augment PR Summary

Summary: Fixes per-slot memory tracking in XINFO STREAM by passing the actual stream key into xinfoReplyWithStreamInfo rather than relying on a hardcoded argv index.

Changes:

  • Update xinfoReplyWithStreamInfo to accept key and use it when calling updateSlotAllocSize.
  • Enable -DDEBUG_ASSERTIONS in the test-ubuntu-jemalloc daily CI job to exercise the relevant assertion path.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@sundb
Copy link
Copy Markdown
Collaborator Author

sundb commented Apr 13, 2026

Reproduce

make REDIS_CFLAGS='-DDEBUG_ASSERTIONS'
./runtest --single unit/memefficiency --only "/Active defrag IDMP streams"

Report:

Logged crash report (pid 537951):
=== REDIS BUG REPORT START: Cut & paste starting from here ===
537951:M 13 Apr 2026 20:32:09.188 # === ASSERTION FAILED CLIENT CONTEXT ===
537951:M 13 Apr 2026 20:32:09.188 # client->flags = 538968064
537951:M 13 Apr 2026 20:32:09.188 # client->conn = fd=15
537951:M 13 Apr 2026 20:32:09.188 # client->argc = 4
537951:M 13 Apr 2026 20:32:09.188 # client->argv[0] = "xinfo" (refcount: 1)
537951:M 13 Apr 2026 20:32:09.188 # client->argv[1] = "stream" (refcount: 1)
537951:M 13 Apr 2026 20:32:09.188 # client->argv[2] = "idmpstream" (refcount: 1)
537951:M 13 Apr 2026 20:32:09.188 # client->argv[3] = "full" (refcount: 1)
537951:M 13 Apr 2026 20:32:09.188 # === RECURSIVE ASSERTION FAILED ===
537951:M 13 Apr 2026 20:32:09.188 # ==> db.c:484 '(int)keyHashSlot(key, (int)sdslen(key)) == server.current_client->slot' is not true

------ STACK TRACE ------

537954 bio_aof
/lib/x86_64-linux-gnu/libc.so.6(+0x98d71)[0x786925a98d71]
/lib/x86_64-linux-gnu/libc.so.6(pthread_cond_wait+0x20d)[0x786925a9b7ed]
src/redis-server 127.0.0.1:21112 [cluster](bioProcessBackgroundJobs+0x1ea)[0x5dc6fadcb58a]
/lib/x86_64-linux-gnu/libc.so.6(+0x9caa4)[0x786925a9caa4]
/lib/x86_64-linux-gnu/libc.so.6(+0x129c6c)[0x786925b29c6c]

537951 redis-server *
src/redis-server 127.0.0.1:21112 [cluster](+0x100420)[0x5dc6fad0c420]
src/redis-server 127.0.0.1:21112 [cluster](xinfoReplyWithStreamInfo+0xa71)[0x5dc6fae54b11]
src/redis-server 127.0.0.1:21112 [cluster](call+0x24c)[0x5dc6faccadbc]
src/redis-server 127.0.0.1:21112 [cluster](processCommand+0xcee)[0x5dc6faccdb8e]
src/redis-server 127.0.0.1:21112 [cluster](processInputBuffer+0xbe3)[0x5dc6facf9033]
src/redis-server 127.0.0.1:21112 [cluster](readQueryFromClient+0x3c8)[0x5dc6facfaa28]
src/redis-server 127.0.0.1:21112 [cluster](+0x25c904)[0x5dc6fae68904]
src/redis-server 127.0.0.1:21112 [cluster](aeMain+0xf9)[0x5dc6faca7f29]
src/redis-server 127.0.0.1:21112 [cluster](main+0x502)[0x5dc6faca1e42]
/lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x786925a2a1ca]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x786925a2a28b]
src/redis-server 127.0.0.1:21112 [cluster](_start+0x25)[0x5dc6faca3655]

537955 bio_lazy_free
/lib/x86_64-linux-gnu/libc.so.6(+0x98d71)[0x786925a98d71]
/lib/x86_64-linux-gnu/libc.so.6(pthread_cond_wait+0x20d)[0x786925a9b7ed]
src/redis-server 127.0.0.1:21112 [cluster](bioProcessBackgroundJobs+0x1ea)[0x5dc6fadcb58a]
/lib/x86_64-linux-gnu/libc.so.6(+0x9caa4)[0x786925a9caa4]
/lib/x86_64-linux-gnu/libc.so.6(+0x129c6c)[0x786925b29c6c]

537953 bio_close_file
/lib/x86_64-linux-gnu/libc.so.6(+0x98d71)[0x786925a98d71]
/lib/x86_64-linux-gnu/libc.so.6(pthread_cond_wait+0x20d)[0x786925a9b7ed]
src/redis-server 127.0.0.1:21112 [cluster](bioProcessBackgroundJobs+0x1ea)[0x5dc6fadcb58a]
/lib/x86_64-linux-gnu/libc.so.6(+0x9caa4)[0x786925a9caa4]
/lib/x86_64-linux-gnu/libc.so.6(+0x129c6c)[0x786925b29c6c]

4/4 expected stacktraces.

------ STACK TRACE DONE ------

=== REDIS BUG REPORT END. Make sure to include from START to END. ===

       Please report the crash by opening an issue on github:

           http://github.com/redis/redis/issues

  If a Redis module was involved, please open in the module's repo instead.

  Suspect RAM error? Use redis-server --test-memory to verify it.

  Some other issues could be detected by redis-server --check-system

@sundb sundb merged commit 2049c7f into redis:unstable Apr 14, 2026
18 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Redis 8.8 Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants