You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/06/16 11:12:56 UTC

[GitHub] [incubator-kvrocks] git-hulk opened a new issue, #633: Wrongly parsed the RESP empty/null array

git-hulk opened a new issue, #633:
URL: https://github.com/apache/incubator-kvrocks/issues/633

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-kvrocks/issues) and found no similar issues.
   
   
   ### Version
   
   b1eb17f0228b40244694b308639a8876c90444ba
   
   ### Minimal reproduce step
   
   According to https://redis.io/docs/reference/protocol-spec/#resp-arrays, 
   empty/null array is allowed in RESP but Kvrocks got the protocol error.
   
   ```shell
   # empty array
   $ echo '*0\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n'|nc 127.0.0.1 6666
   # null array
   $ echo '*-1\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n'|nc 127.0.0.1 6666
   ```
   
   ### What did you expect to see?
   
   Kvrocks can parse those protocol correctly and response the right value of the `key`
   like Redis behavior:
   ```shell
   ❯ echo '*0\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n'|nc 127.0.0.1 6379                                                                                                  
   $-1
   
   ❯ echo '*-1\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n'|nc 127.0.0.1 6379                                                                                                 
   $-1
   ```
   
   ### What did you see instead?
   
   ```shell
   ❯ echo '*0\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n'|nc 127.0.0.1 6666                                                                                                  
   -Protocol error: expected '$'
   
   ❯ echo '*-1\r\n*2\r\n$3\r\nget\r\n$3\r\nkey\r\n'|nc 127.0.0.1 6666                                                                                                 
   -Protocol error: invalid multibulk length
   ```
   
   ### Anything Else?
   
   For the empty array case, Kvrocks should NOT enter the next state when the multi bulk length is 0 at line:[redis_request.cc#L71](https://github.com/apache/incubator-kvrocks/blob/unstable/src/redis_request.cc#L71)
   
   For the null array case, Kvrocks should use `stoll` to parse the number instead of `stoull` since the length maybe negative at line: [redis_request.cc#L62](https://github.com/apache/incubator-kvrocks/blob/unstable/src/redis_request.cc#L62). Also, we need to skip the null array like the empty array case.
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] willshS commented on issue #633: Wrongly parsed the RESP empty/null array

Posted by GitBox <gi...@apache.org>.
willshS commented on issue #633:
URL: https://github.com/apache/incubator-kvrocks/issues/633#issuecomment-1158721340

   我来fix一下这个问题


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] tisonkun closed issue #633: Wrongly parsed the RESP empty/null array

Posted by GitBox <gi...@apache.org>.
tisonkun closed issue #633: Wrongly parsed the RESP empty/null array
URL: https://github.com/apache/incubator-kvrocks/issues/633


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk commented on issue #633: Wrongly parsed the RESP empty/null array

Posted by GitBox <gi...@apache.org>.
git-hulk commented on issue #633:
URL: https://github.com/apache/incubator-kvrocks/issues/633#issuecomment-1158724417

   > I would like to fix this issue.
   
   OK, thanks @willshS 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] tisonkun commented on issue #633: Wrongly parsed the RESP empty/null array

Posted by GitBox <gi...@apache.org>.
tisonkun commented on issue #633:
URL: https://github.com/apache/incubator-kvrocks/issues/633#issuecomment-1158731194

   @willshS thanks for picking this issue. Go ahead!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org