From 440385de143902a77338091cf658d15381e028fa Mon Sep 17 00:00:00 2001 From: WuYunlong Date: Mon, 21 Jan 2019 17:48:45 +0800 Subject: [PATCH] Fix child info pipe fd leak when child process gets killed. --- src/aof.c | 1 + src/db.c | 1 + src/replication.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/aof.c b/src/aof.c index 9723fc333..c23c2c782 100644 --- a/src/aof.c +++ b/src/aof.c @@ -221,6 +221,7 @@ static void killAppendOnlyChild(void) { server.aof_rewrite_time_start = -1; /* Close pipes used for IPC between the two processes. */ aofClosePipes(); + closeChildInfoPipe(); } /* Called when the user switches from "appendonly yes" to "appendonly no" diff --git a/src/db.c b/src/db.c index 62c8aa131..fba8db255 100644 --- a/src/db.c +++ b/src/db.c @@ -451,6 +451,7 @@ void flushallCommand(client *c) { if (server.rdb_child_pid != -1) { kill(server.rdb_child_pid,SIGUSR1); rdbRemoveTempFile(server.rdb_child_pid); + closeChildInfoPipe(); } if (server.saveparamslen > 0) { /* Normally rdbSave() will reset dirty, but we don't want this here diff --git a/src/replication.c b/src/replication.c index a3110661e..4942be5d0 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1255,6 +1255,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) { (long) server.rdb_child_pid); kill(server.rdb_child_pid,SIGUSR1); rdbRemoveTempFile(server.rdb_child_pid); + closeChildInfoPipe(); } if (rename(server.repl_transfer_tmpfile,server.rdb_filename) == -1) {