Ensure client slot migration pointer is cleared during reset (#3554)

If not cleared, the job may no longer be valid by the time the client
goes to cleanup. This dangling reference could cause a crash if you set
slot-migration-log-max-len to 0 and are very unlucky.

Signed-off-by: Jacob Murphy <jkmurphy@google.com>
This commit is contained in:
Jacob Murphy
2026-04-26 20:05:35 -07:00
committed by GitHub
parent a3e44a55d3
commit 28ecbd204f
2 changed files with 2 additions and 2 deletions
+1
View File
@@ -2145,6 +2145,7 @@ void resetSlotMigrationJob(slotMigrationJob *job) {
/* Only one of client or conn should be set. */
serverAssert(!job->client || !job->conn);
if (job->client) {
job->client->slot_migration_job = NULL;
freeClientAsync(job->client);
job->client = NULL;
} else if (job->conn) {
+1 -2
View File
@@ -1978,8 +1978,7 @@ void unlinkClient(client *c) {
}
/* Check if this is the slot migration client we are writing to in a
* child process*/
if (c->slot_migration_job && !isImportSlotMigrationJob(c->slot_migration_job) &&
server.slot_migration_pipe_conn == c->conn) {
if (server.slot_migration_pipe_conn == c->conn) {
server.slot_migration_pipe_conn = NULL;
serverLog(LL_NOTICE, "Slot migration target dropped, killing fork child.");
killSlotMigrationChild();