antirez/hiredis — pull request #112 by nessence (2012-07-11 08:33:02+00:00)
Title: MONITOR causes assertion failure, async.c, line 398.

I've built a client using an asynchronous adapter. After receiving a few responses following "monitor":
Assertion failed: (c->flags & REDIS_SUBSCRIBED), function redisProcessCallbacks, file async.c, line 398.

It looks like this has gone unnoticed because most of the implementations have their own async client implementation instead of using one that's provided. That's too bad because I think the subscription callbacks are very useful! Anyways...

Currently async.c is such that, for every command issued, there must be only one reply; except subscriptions, in which case a check is performed so that appropriate subscription callback can be repetitively called. However, the case of replies because of Monitor isn't considered, so the crash occurs.

You can reproduce this by adding to any of the examples:
redisAsyncCommand(c, getCallback, NULL, "MONITOR");

Then run a few commands on another connection and you should get crash.