summaryrefslogtreecommitdiff
path: root/src/multi.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-08-27 12:54:01 +0300
committerGitHub <noreply@github.com>2020-08-27 12:54:01 +0300
commit9fcd9e191e6f54276688fb7c74e1d5c3c4be9a75 (patch)
treedc153a6a16f6cbbc3ca82ca8fb9021291c48b0f2 /src/multi.c
parent8bdcbbb085888d98b765cc7899009670e019b9d0 (diff)
downloadredis-9fcd9e191e6f54276688fb7c74e1d5c3c4be9a75.tar.gz
Fix rejectCommand trims newline in shared error objects, hung clients (#7714)
65a3307bc (released in 6.0.6) has a side effect, when processCommand rejects a command with pre-made shared object error string, it trims the newlines from the end of the string. if that string is later used with addReply, the newline will be missing, breaking the protocol, and leaving the client hung. It seems that the only scenario which this happens is when replying with -LOADING to some command, and later using that reply from the CONFIG SET command (still during loading). this will result in hung client. Refactoring the code in order to avoid trimming these newlines from shared string objects, and do the newline trimming only in other cases where it's needed. Co-authored-by: Guy Benoish <guy.benoish@redislabs.com>
Diffstat (limited to 'src/multi.c')
-rw-r--r--src/multi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/multi.c b/src/multi.c
index 35ddf92af..a99c308be 100644
--- a/src/multi.c
+++ b/src/multi.c
@@ -127,7 +127,8 @@ void execCommandPropagateExec(client *c) {
/* Aborts a transaction, with a specific error message.
* The transaction is always aboarted with -EXECABORT so that the client knows
* the server exited the multi state, but the actual reason for the abort is
- * included too. */
+ * included too.
+ * Note: 'error' may or may not end with \r\n. see addReplyErrorFormat. */
void execCommandAbort(client *c, sds error) {
discardTransaction(c);