-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memcached: fix stuck on processing GET request #94
Merged
Conversation
This file contains 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
9b3528a
to
da90b77
Compare
3b86908
to
f3a5b65
Compare
f3a5b65
to
3cf6ed3
Compare
Summary: memcached stuck on processing request when number of processed commands is exceeded of (batch_count + 1) and buffer has a request with retrieval command ("get", "gets", "gat", and "gats"). For each incoming connection memcached starts endless loop in function memcached_loop() where it reads network data to buffer (memcached_loop_read), parse commands from a buffer one by one (parse_request), process commands (process_request) and write answers to network socket (memcached_flush). Imagine we have a sequence of requests equal to con->cfg->batch_count (it is a constant value and equal to 20) + 1 with SETQ (SETQ is the same as a SET command, but it is not required confirmation) commands and a single GET command that should return a value set by one of the previous SETQ command. Processing of SETQ commands finished successfully. After processing the latest request with SETQ command we have a GET command in a buffer and batch_count counter become equal to 20 (batch_count initial value is 0). In such case control flow returns to start of the read-parse-process-write loop where we stuck in memcached_loop_read() and wait for next requests instead of replying to client with value of requested key. rc = con->cb.process_request(con); ... if (rc == -1) memcached_loop_error(con); if (con->close_connection) { break; } else if (rc == 0 && ibuf_used(con->in) > 0 && batch_count < con->cfg->batch_count) { goto next; } ... continue; Fixes #73
3cf6ed3
to
d11732f
Compare
Totktonada
approved these changes
Dec 27, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Feel free to proceed.
Seems a temporary network problems on GH side and memcached CI has failed several times in a row:
|
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.
Summary: memcached stuck on processing request when number of
processed commands is exceeded of (batch_count + 1) and buffer has a
request with retrieval command ("get", "gets", "gat", and "gats").
Fixes #73