stream: consumer-group counters can exceed INT64_MAX and break clients decoding RESP integers as signed
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- cpp, redis
- Área
- backend-api-design, databases
Línea de trabajo
Empieza en src/types/redis_stream.cc siguiendo las rutas de decremento de consumer-group indicadas y, después, inspecciona src/server/redis_reply.h y los serializadores de stream/group/consumer de XINFO. Confirma cómo obtiene XPENDING su summary count y compara los posibles enfoques de saturación y de tratamiento en el lado de emisión. Se considera terminado cuando los unsigned counters y las diferencias de timestamps restantes no puedan producir RESP integers fuera del signed 64-bit range, con el comportamiento acordado antes de la implementación.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Several Redis-stream consumer-group counters are stored as uint64_t and emitted directly via redis::Integer (std::to_string, src/server/redis_reply.h). If any of them holds a value above INT64_MAX, the reply is a decimal like :18446744073709551615\r\n, which clients that decode RESP : integers as signed 64-bit (e.g. the Rust fred client) fail to parse — the connection is dropped/poisoned rather than returning group info.
PR #3578 fixes the two concrete instances we hit in production. This issue tracks the remaining, related hardening so it can be discussed before a broader patch (per the contributing guide's "discuss first / prefer focused patches").
Already addressed by #3578
XAUTOCLAIMdeleting a dangling PEL entry without decrementingpending_number(counter drifts up, later wraps).XINFO GROUPSlagwrapping whenentries_read > entries_added(unsigned subtraction).
Remaining, same failure class
-
Non-saturating
pending_numberdecrements. After #3578,AutoClaimis the only saturating decrement; these still subtract unconditionally, so any invariant break wraps a client-visibleuint64counter (allsrc/types/redis_stream.cc):DeleteConsumer(XGROUP DELCONSUMER):group.pending_number -= deleted_pel— cross-level (subtracts a consumer's count from the group's count), highest risk.DeletePelEntries(XACK):group.pending_number -= *acknowledgedandconsumer.pending_number -= ack_count.ClaimPelEntries(XCLAIM):original_consumer.pending_number -= 1.
-
lagcan exceedINT64_MAXeven without a wrap.entries_addedis settable to anyuint64viaXSETID ... ENTRIESADDED n, so a correctly-computedlag = entries_added - entries_readcan be a legitimate value> INT64_MAXthatCheckLagValidpasses through to the reply. #3578's guard only covers theentries_read > entries_addedwrap. -
No emit-side clamp for already-corrupt data. #3578 stops future drift but doesn't repair or clamp existing values, and other unsigned fields are emitted raw: group/consumer
pending_number(XINFO GROUPS/CONSUMERS),entries-added(XINFO STREAM), and theidle/inactivetimestamp deltas (now - stored_ts, which wrap under clock skew / a future ts injected via XCLAIM). (The XPENDING summary count appears to be recomputed live from the PEL scan — worth confirming whether it reads the cached counter on any path.)
Suggested direction
- Make all consumer-group counter decrements saturating (
x >= n ? x - n : 0), matching #3578's AutoClaim decrement. - Either treat
lag > INT64_MAXas unknown (nil, via the existingUINT64_MAXsentinel) inCheckLagValid, or add an emit-side clamp helper (min(v, INT64_MAX)) applied to the counter/timestamp serializations so the wire value is always within i64 for strict clients. Redis already treats these as signed, so clamping is behavior-compatible.
Happy to send a PR once there's agreement on the preferred shape (per-site saturation vs. a shared emit-side clamp).
AI assistance: the analysis behind this issue was done with AI help; I've reviewed and verified the findings against the source.
- Lenguaje dominante
- C++
- Estrellas
- 4.5k
- Forks
- 686
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 40
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/kvrocks
-
HSETEXPIRE with an overflowing TTL returns OK and deletes the whole hashPosiblemente ocupada @anubhavgupta121 la tomó hace 17 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
SSCAN, HSCAN, ZSCAN don't finish when an empty-string member is returned at the end of a pagePosiblemente ocupada @ggyuchive la tomó hace 1 día. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
`GEOSEARCH` / `GEORADIUS` with a negative radius hangsPosiblemente ocupada @ggyuchive la tomó hace 6 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
`ZDIFFSTORE` and `ZINTERSTORE` with numkeys 0 crash the server (SIGSEGV)Posiblemente ocupada @siddiqueirshad la tomó hace 8 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Support the `SUNIONCARD` commandPosiblemente ocupada @PoisonGodv la tomó hace 3 días. Abiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
apache/kvrocks#3723 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/kvrocks
Issues similares
-
documentation enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
QuantStack/git2cpp#203 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
BaptisteHudyma/Lamp-Da#588 ·
Los mantenedores suelen responder en 1 día
-
bug macOS networking
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
docling-project/docling-parse#448 ·
Los mantenedores suelen responder en 5 días