From 6b6e6f6c1ef49f87f794de512489e5fbbfb67ca0 Mon Sep 17 00:00:00 2001 From: John Sully Date: Mon, 29 Jul 2019 15:08:41 -0400 Subject: [PATCH] Fix crash in RediSearch --- src/module.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/module.cpp b/src/module.cpp index 568205f90..8d935c0cc 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -3930,6 +3930,8 @@ void RM_FreeThreadSafeContext(RedisModuleCtx *ctx) { void RM_ThreadSafeContextLock(RedisModuleCtx *ctx) { UNUSED(ctx); moduleAcquireGIL(FALSE /*fServerThread*/); + if (serverTL == nullptr) + serverTL = &g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN]; // arbitrary module threads get the main thread context } /* Release the server lock after a thread safe API call was executed. */