From 542a83edecb6cbd4e47f32b9d38975943cda8cd3 Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 30 May 2021 02:08:02 +0000 Subject: [PATCH] Handle race where a different thread cancels the replication but we haven't closed the connection Former-commit-id: 92e48f071792985c2fb7f4c722329e832cd4c77b --- src/replication.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/replication.cpp b/src/replication.cpp index 109af53e5..491e3b17f 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -1993,6 +1993,10 @@ void readSyncBulkPayload(connection *conn) { // Should we update our database, or create from scratch? int fUpdate = g_pserver->fActiveReplica || g_pserver->enable_multimaster; redisMaster *mi = (redisMaster*)connGetPrivateData(conn); + if (mi == nullptr) { + // We're about to be free'd so bail out + return; + } serverAssert(GlobalLocksAcquired()); serverAssert(mi->master == nullptr);