From bb875603fb7ff3f9d19aad906bd45d7db98d9a39 Mon Sep 17 00:00:00 2001 From: ivanstosic-janea <82372754+ivanstosic-janea@users.noreply.github.com> Date: Mon, 7 Feb 2022 21:57:11 +0100 Subject: [PATCH] Fix protocol error caused by redis-benchmark (#10236) The protocol error was caused by the buggy `writeHandler` in `redis-benchmark.c`, which didn't handle one of the cases, thereby repeating data, leading to protocol errors when the values being sent are very long. This PR fixes #10233, issue introduced by #7959 --- src/redis-benchmark.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 86421e33f..16c0d8d64 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -632,6 +632,9 @@ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask) { fprintf(stderr, "Error writing to the server: %s\n", strerror(errno)); freeClient(c); return; + } else if (nwritten > 0) { + c->written += nwritten; + return; } } else { aeDeleteFileEvent(el,c->context->fd,AE_WRITABLE);