twitter / twemproxy

A fast, light-weight proxy for memcached and redis
Apache License 2.0
12.16k stars 2.06k forks source link

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

Closed TysonAndre closed 3 years ago

TysonAndre commented 3 years ago

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 https://github.com/twitter/twemproxy/pull/565