File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -911,6 +911,16 @@ void unlinkClient(client *c) {
911911 c -> client_list_node = NULL ;
912912 }
913913
914+ /* In the case of diskless replication the fork is writing to the
915+ * sockets and just closing the fd isn't enough, if we don't also
916+ * shutdown the socket the fork will continue to write to the slave
917+ * and the salve will only find out that it was disconnected when
918+ * it will finish reading the rdb. */
919+ if ((c -> flags & CLIENT_SLAVE ) &&
920+ (c -> replstate == SLAVE_STATE_WAIT_BGSAVE_END )) {
921+ shutdown (c -> fd , SHUT_RDWR );
922+ }
923+
914924 /* Unregister async I/O handlers and close the socket. */
915925 aeDeleteFileEvent (server .el ,c -> fd ,AE_READABLE );
916926 aeDeleteFileEvent (server .el ,c -> fd ,AE_WRITABLE );
Original file line number Diff line number Diff line change @@ -593,6 +593,7 @@ int startBgsaveForReplication(int mincapa) {
593593 client * slave = ln -> value ;
594594
595595 if (slave -> replstate == SLAVE_STATE_WAIT_BGSAVE_START ) {
596+ slave -> replstate = REPL_STATE_NONE ;
596597 slave -> flags &= ~CLIENT_SLAVE ;
597598 listDelNode (server .slaves ,ln );
598599 addReplyError (slave ,
You can’t perform that action at this time.
0 commit comments