Only mark the client reprocessing flag when unblocked on keys (#2…#2231
Merged
ranshid merged 1 commit intovalkey-io:7.2from Jun 18, 2025
Merged
Only mark the client reprocessing flag when unblocked on keys (#2…#2231ranshid merged 1 commit intovalkey-io:7.2from
ranshid merged 1 commit intovalkey-io:7.2from
Conversation
…y-io#2109) When we refactored the blocking framework we introduced the client reprocessing infrastructure. In cases the client was blocked on keys, it will attempt to reprocess the command. One challenge was to keep track of the command timeout, since we are reprocessing and do not want to re-register the client with a fresh timeout each time. The solution was to consider the client reprocessing flag when the client is blockedOnKeys: ``` if (!c->flag.reprocessing_command) { /* If the client is re-processing the command, we do not set the timeout * because we need to retain the client's original timeout. */ c->bstate->timeout = timeout; } ``` However, this introduced a new issue. There are cases where the client will consecutive blocking of different types for example: ``` CLIENT PAUSE 10000 ALL BZPOPMAX zset 1 ``` would have the client blocked on the zset endlessly if nothing will be written to it. **Credits to @uriyage for locating this with his fuzzer testing** The suggested solution is to only flag the client when it is specifically unblocked on keys. Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
enjoy-binbin
approved these changes
Jun 18, 2025
Member
enjoy-binbin
left a comment
There was a problem hiding this comment.
so we are doing this backport thing one PR by on PR?
Member
Author
The cherry-pick was just impossible |
Member
Author
And I think since the code is somewhat different it require a separate PR. If you prefer I can eliminate this PR and include in the release PR but changes there are going to be strange IMO |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 7.2 #2231 +/- ##
===========================
===========================
🚀 New features to boost your workflow:
|
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.
NOTE - this is a backport of #2109
When we refactored the blocking framework we introduced the client
reprocessing infrastructure. In cases the client was blocked on keys, it
will attempt to reprocess the command. One challenge was to keep track
of the command timeout, since we are reprocessing and do not want to
re-register the client with a fresh timeout each time. The solution was
to consider the client reprocessing flag when the client is
blockedOnKeys:
However, this introduced a new issue. There are cases where the client
will consecutive blocking of different types for example:
would have the client blocked on the zset endlessly if nothing will be
written to it.
Credits to @uriyage for locating this with his fuzzer testing
The suggested solution is to only flag the client when it is
specifically unblocked on keys.