From 968d81dcf991479869ec1e7081a7cf60da1701fd Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 23 Dec 2021 13:12:34 -0500 Subject: [PATCH 1/4] Fix module test break Former-commit-id: 50dfee2039e199f60f927790e7ac81625402b191 --- src/module.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/module.cpp b/src/module.cpp index fb2a66fc1..252082036 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -4289,7 +4289,14 @@ RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const ch if (!(flags & REDISMODULE_ARGV_NO_REPLICAS)) call_flags |= CMD_CALL_PROPAGATE_REPL; } + + { + aeAcquireLock(); + std::unique_lock ul(c->lock); call(c,call_flags); + aeReleaseLock(); + } + g_pserver->replication_allowed = prev_replication_allowed; serverAssert((c->flags & CLIENT_BLOCKED) == 0); From 7a0b94f0ef4eddc142507a64f4b64ccb86c7f815 Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 23 Dec 2021 13:12:59 -0500 Subject: [PATCH 2/4] Apple build break fix Former-commit-id: 7a32ec39fdb738e9c3cd2b73ee18355ced793a65 --- src/server.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server.cpp b/src/server.cpp index 60454fe58..ab75ac589 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -6562,7 +6562,11 @@ void *timeThreadMain(void*) { } } updateCachedTime(); +#if defined(__APPLE__) + nanosleep(&delay, nullptr); +#else clock_nanosleep(CLOCK_MONOTONIC, 0, &delay, NULL); +#endif } } From 9415fe7e1cc8132f5bf5c01fa7e82fa55e239c74 Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 23 Dec 2021 13:17:14 -0500 Subject: [PATCH 3/4] Fix deadlock issue #183 cause by lock inversion Former-commit-id: e070651039975ad1d5be4a5f7cbb28eeefcb0015 --- src/networking.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/networking.cpp b/src/networking.cpp index cc031a25a..903552cf4 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -1942,7 +1942,9 @@ void ProcessPendingAsyncWrites() bool fResult = c->postFunction([](client *c) { c->fPendingAsyncWriteHandler = false; clientInstallWriteHandler(c); + c->lock.unlock(); handleClientsWithPendingWrites(c->iel, g_pserver->aof_state); + c->lock.lock(); }, false); if (!fResult) From 30cd45b8db4ff37407039e5c1ab96206fe703196 Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 23 Dec 2021 14:20:41 -0500 Subject: [PATCH 4/4] Remove double free in keydb-benchmark Former-commit-id: b4528b797de8ea81d4bfabbfd86231c6a904e7f4 --- src/redis-benchmark.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/redis-benchmark.cpp b/src/redis-benchmark.cpp index a33ef2dab..59904947d 100644 --- a/src/redis-benchmark.cpp +++ b/src/redis-benchmark.cpp @@ -1984,7 +1984,6 @@ int main(int argc, const char **argv) { } while(config.loop); zfree(data); - zfree(data); if (config.redis_config != NULL) freeRedisConfig(config.redis_config); return 0;