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); diff --git a/src/networking.cpp b/src/networking.cpp index a6dcf3d43..76223b76d 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) 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; 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 } }