]> git.saurik.com Git - redis.git/commitdiff
Fix for bug 374, thanks to Jeremy Zawodny for reporting and tracing why it was crashing.
authorantirez <antirez@gmail.com>
Fri, 12 Nov 2010 19:02:20 +0000 (20:02 +0100)
committerantirez <antirez@gmail.com>
Fri, 12 Nov 2010 19:02:20 +0000 (20:02 +0100)
src/replication.c

index f6ecc1c6654c1e4ada3fa964c4e4fa6510edae27..a49aa2d8ed48f3871040f98279f9bba6acc90a7a 100644 (file)
@@ -366,13 +366,17 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
         }
         redisLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Loading DB in memory");
         emptyDb();
+        /* Before loading the DB into memory we need to delete the readable
+         * handler, otherwise it will get called recursively since
+         * rdbLoad() will call the event loop to process events from time to
+         * time for non blocking loading. */
+        aeDeleteFileEvent(server.el,server.repl_transfer_s,AE_READABLE);
         if (rdbLoad(server.dbfilename) != REDIS_OK) {
             redisLog(REDIS_WARNING,"Failed trying to load the MASTER synchronization DB from disk");
             replicationAbortSyncTransfer();
             return;
         }
         /* Final setup of the connected slave <- master link */
-        aeDeleteFileEvent(server.el,server.repl_transfer_s,AE_READABLE);
         zfree(server.repl_transfer_tmpfile);
         close(server.repl_transfer_fd);
         server.master = createClient(server.repl_transfer_s);