From eca5e75b2a8bf7e4319f214ddc0e3b5e9f4522b8 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Mon, 10 May 2021 17:08:43 +0300 Subject: [PATCH] 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) --- src/lazyfree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lazyfree.c b/src/lazyfree.c index a2cf2c3ed..180a4349b 100644 --- a/src/lazyfree.c +++ b/src/lazyfree.c @@ -109,7 +109,7 @@ size_t lazyfreeGetFreeEffort(robj *key, 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);