Skip to content
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

Fix processing of redis multibulk (nested array) responses (from eval, new commands, etc) #612

Merged
merged 4 commits into from
Jul 1, 2021

Conversation

TysonAndre
Copy link
Collaborator

@TysonAndre TysonAndre commented Jul 1, 2021

Problem

Redis hangs or misbehaves when processing multibulk redis responses (nested arrays)

Solution

Keep track of how many more elements need to be parsed when parsing the redis response,
as well as whether the top-level value is a multi-bulk response

Continue to properly count the number of top level array elements for request types that can be fragmented such as multi-gets

Result

twemproxy will now be able to proxy results of eval and other commands when they return nested arrays
(this will help in implementing command and georadiuswithcoord. commands in the future)

This is an amended version of #565

qingping209 and others added 4 commits June 30, 2021 21:55
i.e. the response of georadiuswithcoord.
This is achieved by introducing a small stack in struct msg,
this stack remembers the number of arguments to be parsed of current multibulk
and all nesting multibulks.

Co-Authored-By: qingping209 <[email protected]>
Co-Authored-By: Tyson Andre <[email protected]>

This is a subset of twitter#565
(only the multibulk implementation changes by qingping209)
This amends the approach originally proposed in
twitter#565

We don't need to keep a stack, we only need to keep track
of how many more remaining elements need to be parsed from the redis
response, decreasing it when an element is processed,
and increasing it when a new redis array is seen based on the array length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants