From 8bd5e391020cb9d5992d3d30cb5f85ead6b15c95 Mon Sep 17 00:00:00 2001 From: yvette903 <49490087+yvette903@users.noreply.github.com> Date: Tue, 15 Jun 2021 14:21:52 +0800 Subject: [PATCH] Fix coredump after Client Unpause command when threaded I/O is enabled (#9041) Fix crash when using io-threads-do-reads and issuing CLIENT PAUSE and CLIENT UNPAUSE. This issue was introduced in redis 6.2 together with the FAILOVER command. (cherry picked from commit 096c5fd5d22caa2c21a4863cbaaf64fd8e7107d2) --- src/networking.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index 9de105982..d59e49592 100644 --- a/src/networking.c +++ b/src/networking.c @@ -3654,7 +3654,7 @@ int postponeClientRead(client *c) { if (server.io_threads_active && server.io_threads_do_reads && !ProcessingEventsWhileBlocked && - !(c->flags & (CLIENT_MASTER|CLIENT_SLAVE|CLIENT_PENDING_READ))) + !(c->flags & (CLIENT_MASTER|CLIENT_SLAVE|CLIENT_PENDING_READ|CLIENT_BLOCKED))) { c->flags |= CLIENT_PENDING_READ; listAddNodeHead(server.clients_pending_read,c); @@ -3718,6 +3718,7 @@ int handleClientsWithPendingReadsUsingThreads(void) { c->flags &= ~CLIENT_PENDING_READ; listDelNode(server.clients_pending_read,ln); + serverAssert(!(c->flags & CLIENT_BLOCKED)); if (processPendingCommandsAndResetClient(c) == C_ERR) { /* If the client is no longer valid, we avoid * processing the client later. So we just go