From 9ab1278cf134f12091fc52c09230d57dea1bc58d Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 14 Jul 2023 14:38:39 -0400 Subject: [PATCH] Prevent a deadlock when running CLIENT KILL with large numbers of clients (#206) --- src/networking.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/networking.cpp b/src/networking.cpp index 90c75a695..1728b5f29 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -3257,16 +3257,18 @@ NULL } else { - int iel = client->iel; freeClientAsync(client); - aePostFunction(g_pserver->rgthreadvar[client->iel].el, [iel] { // note: failure is OK - freeClientsInAsyncFreeQueue(iel); - }); } } killed++; } + for (int iel = 0; iel < cserver.cthreads; ++iel) { + aePostFunction(g_pserver->rgthreadvar[iel].el, [iel] { // note: failure is OK + freeClientsInAsyncFreeQueue(iel); + }); + } + /* Reply according to old/new format. */ if (c->argc == 3) { if (killed == 0)