Repository navigation
Revert multi OOM limit and add multi buffer limit - #12961
Merged
Merged
Conversation
oranagra
reviewed
Jan 18, 2024
Contributor
Author
oranagra
approved these changes
Jan 24, 2024
Member
|
added a paragraph at the bottom of the description above, PTAL |
madolson
approved these changes
Jan 24, 2024
Contributor
|
I'm fine merging it with or without the querybuf limit updates. |
Contributor
Author
|
I have added the restriction for unauthenticated clients to the top comment. Please review and confirm. |
enjoy-binbin
added a commit
to enjoy-binbin/redis
that referenced
this pull request
Jan 25, 2024
Code incorrectly set the limit value to 1024MB. Introduced in redis#12961.
oranagra
pushed a commit
that referenced
this pull request
Jan 25, 2024
Code incorrectly set the limit value to 1024MB. Introduced in #12961.
roggervalf
pushed a commit
to roggervalf/redis
that referenced
this pull request
Feb 11, 2024
Fix redis#9926 , and introduce an alternative method to prevent abuse of transactions: 1. revert redis#5454 (which was blocking read-only transactions in OOM state), and break the tie of MULTI state memory usage and the server OOM state. Meaning that we'll limit the total memory a single client can queue, and do that unconditionally regardless of the server being OOM or not. 2. to prevent abuse of transactions, we use the `client-query-buffer-limit` to restrict the size of the transaction. Because the commands cached in the MULTI/EXEC queue have not been executed yet, so they are also considered a part of the "query buffer" in a broader sense. In other words, the commands in the MULTI queue and the `querybuf` of the client together constitute the "query buffer". When they exceed the limit, the connection will be disconnected. The reasoning is that it's sensible to sends a single command with a huge (1GB) argument, and it's sensible to sends a transaction with many small commands, but it's probably not common to sends a long transaction with many huge arguments (will consume a lot of memory before even being executed). If anyone runs into that, they can simply increase the `client-query-buffer-limit` config. P.S. To prevent DDoS attacks, unauthenticated clients have a separate hard limit. Their query buffer should not exceed a maximum of 1MB. In other words, if the query buffer of an unauthenticated client exceeds 1MB or the `client-query-buffer-limit` (if it is set to a value smaller than 1MB,), the connection will be disconnected.
roggervalf
pushed a commit
to roggervalf/redis
that referenced
this pull request
Feb 11, 2024
Code incorrectly set the limit value to 1024MB. Introduced in redis#12961.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #9926 , and introduce an alternative method to prevent abuse of transactions:
client-query-buffer-limitto restrict the size of the transaction. Because the commands cached in the MULTI/EXEC queue have not been executed yet, so they are also considered a part of the "query buffer" in a broader sense. In other words, the commands in the MULTI queue and thequerybufof the client together constitute the "query buffer". When they exceed the limit, the connection will be disconnected.The reasoning is that it's sensible to sends a single command with a huge (1GB) argument, and it's sensible to sends a transaction with many small commands, but it's probably not common to sends a long transaction with many huge arguments (will consume a lot of memory before even being executed).
If anyone runs into that, they can simply increase the
client-query-buffer-limitconfig.P.S. To prevent DDoS attacks, unauthenticated clients have a separate hard limit. Their query buffer should not exceed a maximum of 1MB. In other words, if the query buffer of an unauthenticated client exceeds 1MB or the
client-query-buffer-limit(if it is set to a value smaller than 1MB,), the connection will be disconnected.