[PATCH] applier: stop sending ACKs if master closed socket

Vladimir Davydov vdavydov.dev at gmail.com
Mon Jan 29 18:45:42 MSK 2018


If the master closes its end of the socket when there are still unread
rows available for the replica to apply, we will get tons of EPIPE error
messages at the replica's side, emitted every time it attempts to send
an ACK back to the master (i.e. one per each row left in the socket):

  main/107/applierw/ sio.cc:303 !> SystemError writev(2), called on fd 12, aka 127.0.0.1:50852: Broken pipe

To avoid that, let's make the applier writer fiber (the one that sends
ACKs) exit immediately if it receives EPIPE error while trying to send
an ACK.

Closes #2945
---
Branch: gh-2945-applier-dont-send-acks-if-master-closed-socket

 src/box/applier.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/box/applier.cc b/src/box/applier.cc
index f0073bad..e8907975 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -118,6 +118,13 @@ applier_writer_f(va_list ap)
 			coio_write_xrow(&io, &xrow);
 		} catch (SocketError *e) {
 			/*
+			 * There is no point trying to send ACKs if
+			 * the master closed its end - we would only
+			 * spam the log - so exit immediately.
+			 */
+			if (e->get_errno() == EPIPE)
+				break;
+			/*
 			 * Do not exit, if there is a network error,
 			 * the reader fiber will reconnect for us
 			 * and signal our cond afterwards.
-- 
2.11.0




More information about the Tarantool-patches mailing list