eleme / corvus

A fast and lightweight Redis Cluster Proxy for Redis 3.0
MIT License
789 stars 143 forks source link

unknown command type 'Q' (parser.c:155) #133

Open viaweb3 opened 7 years ago

viaweb3 commented 7 years ago

phpredis

doyoubi commented 7 years ago

Thanks for reporting this. Do you know which command you're sending to corvus when encountering this error? Is your php client multi-threaded? Does the same error message get printed again and again? Need more information to figure out what's going on.

viaweb3 commented 7 years ago

php客户端是单线程短连接,会一直打印这个错误,由于是短连接,应该是socket关闭时的quit指令。

doyoubi commented 7 years ago

@pinguo-niulingyun 请问可以稳定复现吗? 求复现方法 (php版本, phpredis版本, 相关代码).

In case someone also has the same problem, it would be great if you can provide the way to reproduce it.

jasonjoo2010 commented 6 years ago

@pinguo-niulingyun

Yeah, the problem exists in function "redis_sock_disconnect", something like this:

`PHPAPI int redis_sock_disconnect(RedisSock *redis_sock TSRMLS_DC) { if (redis_sock == NULL) { return 1; }

redis_sock->dbNumber = 0;
if (redis_sock->stream != NULL) {
        if (!redis_sock->persistent) {
            redis_sock_write(redis_sock, "*\r\n$4\r\nQUIT\r\n" _NL, sizeof("*\r\n$4\r\nQUIT\r\n" _NL) - 1 TSRMLS_CC);
        }`

The original string is simply "QUIT" which is not obey the text protocol. you should fix the source in your redis extension source code and recompile it to your dist.