From 05d8e2c938e3b06efe3573deb97adb767550becc Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 1 Nov 2012 22:39:39 +0100 Subject: [PATCH] More robust handling of AOF rewrite child. After the wait3() syscall we used to do something like that: if (pid == server.rdb_child_pid) { backgroundSaveDoneHandler(exitcode,bysignal); } else { .... } So the AOF rewrite was handled in the else branch without actually checking if the pid really matches. This commit makes the check explicit and logs at WARNING level if the pid returned by wait3() does not match neither the RDB or AOF rewrite child. --- src/redis.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/redis.c b/src/redis.c index fc8f0788..e4b36798 100644 --- a/src/redis.c +++ b/src/redis.c @@ -915,8 +915,12 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { if (pid == server.rdb_child_pid) { backgroundSaveDoneHandler(exitcode,bysignal); - } else { + } else if (pid == server.aof_child_pid) { backgroundRewriteDoneHandler(exitcode,bysignal); + } else { + redisLog(REDIS_WARNING, + "Warning, detected child with unmatched pid: %ld", + (long)pid); } updateDictResizePolicy(); } -- 2.45.2