summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2021-05-10 17:08:43 +0300
committerOran Agra <oran@redislabs.com>2021-06-01 17:03:44 +0300
commit0d05570a82b730ef3493fbe972d5b5f5752faa64 (patch)
tree810b1bc90587257dd759755c8f13b59022e38bd6
parent1d4ebefbffe7c1e3c9d1523b9e0aa9f3013d98ab (diff)
downloadredis-0d05570a82b730ef3493fbe972d5b5f5752faa64.tar.gz
Fix crash unlinking a stream with groups rax and no groups (#8932)
When estimating the effort for unlink, we try to compute the effort of the first group and extrapolate. If there's a groups rax that's empty, there'a an assertion. reproduce: xadd s * a b xgroup create s bla $ xgroup destroy s bla unlink s (cherry picked from commit 97108845e2ae7661e5091c817cb03459ec81ea8c)
-rw-r--r--src/lazyfree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lazyfree.c b/src/lazyfree.c
index 31197df2e..2557a7504 100644
--- a/src/lazyfree.c
+++ b/src/lazyfree.c
@@ -52,7 +52,7 @@ size_t lazyfreeGetFreeEffort(robj *obj) {
/* Every consumer group is an allocation and so are the entries in its
* PEL. We use size of the first group's PEL as an estimate for all
* others. */
- if (s->cgroups) {
+ if (s->cgroups && raxSize(s->cgroups)) {
raxIterator ri;
streamCG *cg;
raxStart(&ri,s->cgroups);