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

Correctly return remaining data after parsing RESP array #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

climvalencia
Copy link

I found a bug in the redis_reply:data/1 parser.

If the redis server should return a reply array followed by any data (PONG in the example below), the redis_reply parser will incorrectly include PONG in the list of values, then finally return with a pending status.

1> redis_reply:data(<<"*2\r\n$4\r\nmem2\r\n$4\r\nmem1\r\n+PONG\r\n">>, {unknown, <<>>}).
{pending,{multi,2,
                ["PONG",<<"mem1">>,<<"mem2">>],
                {unknown,<<>>}}}

This results in redis_client (the calling process) ending up with a broken state that never sends back the replies.

Applying this fix should return the correct values:

1> redis_reply:data(<<"*2\r\n$4\r\nmem2\r\n$4\r\nmem1\r\n+PONG\r\n">>, {unknown, <<>>}).
{{value,{ok,[<<"mem2">>,<<"mem1">>]}},
 {unknown,<<"+PONG\r\n">>}}

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.

1 participant