wooga / eredis

Erlang Redis client
MIT License
628 stars 279 forks source link

Parser doesn't handle multibulks in multibulks #3

Closed brendonh closed 12 years ago

brendonh commented 13 years ago

A MULTI ... EXEC sequence can include calls that return multibulks, and will then be embedded inside the multibulk reply to EXEC.

e.g., to pop stuff older than a certain time from a sorted set: MULTI ZRANGEBYSCORE somekey -inf ZREMRANGEBYSCORE somekey -inf EXEC

This will currently crash eredis with an error like "no function clause matching eredis_parser:parse_bulk(<<"*2\r\n$3\r\nhah\r\n$4\r\nwhat\r\n:2\r\n">>)"

knutin commented 13 years ago

Hi Brendon,

Yes, eredis only handles simple status replies from within nested bulks. We haven't had this use case yet, so there was never any need for us to implement it.

The problem is really that you must expect the nested multibulk to also be split, like for the bulks and normal multibulks. I had a quick look and couldn't find any obvious and simple way to support this with the current parser.

If you are interested, I would very much appreciate a patch.

Knut

jdavisp3 commented 13 years ago

I believe this is now fixed in trunk, can you confirm Brendon?