From 27cae3750c62b520f6b376c4f2613b1a7cf00d9c Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 29 May 2020 20:27:45 -0400 Subject: [PATCH] sendFile blocks too long for use with active replication Former-commit-id: aad6a7ce159a3679633020dc407a2068129bbd49 --- src/replication.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/replication.cpp b/src/replication.cpp index f4196eb07..58b080d53 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -1386,13 +1386,15 @@ void sendBulkToSlave(connection *conn) { * fallback to normal read+write otherwise. */ nwritten = 0; #if HAVE_SENDFILE - if (!g_pserver->tls_replication) { + if (!g_pserver->tls_replication && !g_pserver->fActiveReplica) { // sendfile blocks too long for active replication if ((nwritten = redis_sendfile(conn->fd,replica->repldbfd, replica->repldboff,PROTO_IOBUF_LEN)) == -1) { if (errno != EAGAIN) { serverLog(LL_WARNING,"Sendfile error sending DB to replica: %s", strerror(errno)); + ul.unlock(); + aeLock.arm(nullptr); freeClient(replica); } return; @@ -1408,6 +1410,8 @@ void sendBulkToSlave(connection *conn) { if (buflen <= 0) { serverLog(LL_WARNING,"Read error sending DB to replica: %s", (buflen == 0) ? "premature EOF" : strerror(errno)); + ul.unlock(); + aeLock.arm(nullptr); freeClient(replica); return; } @@ -1415,6 +1419,8 @@ void sendBulkToSlave(connection *conn) { if (connGetState(conn) != CONN_STATE_CONNECTED) { serverLog(LL_WARNING,"Write error sending DB to replica: %s", connGetLastError(conn)); + ul.unlock(); + aeLock.arm(nullptr); freeClient(replica); } return;