Skip to content

Commit 6b6e6f6

Browse files
committed
Fix crash in RediSearch
1 parent b0a0f03 commit 6b6e6f6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/module.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3930,6 +3930,8 @@ void RM_FreeThreadSafeContext(RedisModuleCtx *ctx) {
39303930
void RM_ThreadSafeContextLock(RedisModuleCtx *ctx) {
39313931
UNUSED(ctx);
39323932
moduleAcquireGIL(FALSE /*fServerThread*/);
3933+
if (serverTL == nullptr)
3934+
serverTL = &g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN]; // arbitrary module threads get the main thread context
39333935
}
39343936

39353937
/* Release the server lock after a thread safe API call was executed. */

0 commit comments

Comments
 (0)