From a6f8745127915dfb8ba3ee9cfff6cc34bce07e82 Mon Sep 17 00:00:00 2001 From: Wang Yuan Date: Sun, 27 Sep 2020 17:35:16 +0800 Subject: [PATCH] Don't support Gopher if enable io threads to read queries (#7851) There's currently an issue with IO threads and gopher (issuing lookupKey from within the thread). simply fix is to just not support it for now. (cherry picked from commit 9bdef76f8e3bbfaacf0962ab1ceded1bafa80bda) --- redis.conf | 8 +++++--- src/networking.c | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/redis.conf b/redis.conf index 38499b276..ab0a30cbd 100644 --- a/redis.conf +++ b/redis.conf @@ -1519,8 +1519,11 @@ notify-keyspace-events "" # # So use the 'requirepass' option to protect your instance. # -# To enable Gopher support uncomment the following line and set -# the option from no (the default) to yes. +# Note that Gopher is not currently supported when 'io-threads-do-reads' +# is enabled. +# +# To enable Gopher support, uncomment the following line and set the option +# from no (the default) to yes. # # gopher-enabled no @@ -1860,4 +1863,3 @@ jemalloc-bg-thread yes # # Set bgsave child process to cpu affinity 1,10,11 # bgsave_cpulist 1,10-11 - diff --git a/src/networking.c b/src/networking.c index 9b744eb0c..445150ab3 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1884,8 +1884,9 @@ void processInputBuffer(client *c) { if (c->reqtype == PROTO_REQ_INLINE) { if (processInlineBuffer(c) != C_OK) break; /* If the Gopher mode and we got zero or one argument, process - * the request in Gopher mode. */ - if (server.gopher_enabled && + * the request in Gopher mode. To avoid data race, Redis won't + * support Gopher if enable io threads to read queries. */ + if (server.gopher_enabled && !server.io_threads_do_reads && ((c->argc == 1 && ((char*)(c->argv[0]->ptr))[0] == '/') || c->argc == 0)) {