You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "LindaSummer (via GitHub)" <gi...@apache.org> on 2024/06/01 14:01:01 UTC

[I] [Bug] XINFO overflow when deleting pending message and consumer [kvrocks]

LindaSummer opened a new issue, #2350:
URL: https://github.com/apache/kvrocks/issues/2350

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
   
   
   ### Version
   
   version: unstable
   kvrocks_version: unstable
   redis_version:4.0.0
   git_sha1: d2e0feb
   kvrocks_git_sha1: d2e0feb
   redis_mode: standalone
   kvrocks_mode: standalone
   os: Linux 5.14.0-162.6.1.el9_1.0.1.x86_64 x86_64
   gcc_version: 11.2.1
   arch_bits: 64
   process_id: 1
   tcp_port: 6666
   uptime_in_seconds: 1444
   uptime_in_days: 0
   
   ### Minimal reproduce step
   
   Here is the step using redis-cli:
   
   ```bash
   ~ redis-cli -h kvrocks-server -p 6666
   kvrocks-server:6666> xgroup create overflow-test info-count-test $ MKSTREAM
   OK
   kvrocks-server:6666> xgroup createconsumer overflow-test info-count-test consumer-1
   (integer) 1
   kvrocks-server:6666> xinfo groups overflow-test
   1)  1) "name"
       2) "info-count-test"
       3) "consumers"
       4) (integer) 1
       5) "pending"
       6) (integer) 0
       7) "last-delivered-id"
       8) "0-0"
       9) "entries-read"
      10) (nil)
      11) "lag"
      12) (integer) 0
   kvrocks-server:6666> xadd overflow-test * testing overflow
   "1717248597227-0"
   kvrocks-server:6666> xinfo groups overflow-test
   1)  1) "name"
       2) "info-count-test"
       3) "consumers"
       4) (integer) 1
       5) "pending"
       6) (integer) 0
       7) "last-delivered-id"
       8) "0-0"
       9) "entries-read"
      10) (nil)
      11) "lag"
      12) (integer) 1
   kvrocks-server:6666> xreadgroup group info-count-test consumer-1 count 1 streams overflow-test >
   1) 1) "overflow-test"
      2) 1) 1) "1717248597227-0"
            2) 1) "testing"
               2) "overflow"
   kvrocks-server:6666> xinfo groups overflow-test
   1)  1) "name"
       2) "info-count-test"
       3) "consumers"
       4) (integer) 1
       5) "pending"
       6) (integer) 1
       7) "last-delivered-id"
       8) "1717248597227-0"
       9) "entries-read"
      10) (integer) 0
      11) "lag"
      12) (integer) 1
   kvrocks-server:6666> xack overflow-test info-count-test 1717248597227-0
   (integer) 1
   kvrocks-server:6666> xinfo groups overflow-test
   1)  1) "name"
       2) "info-count-test"
       3) "consumers"
       4) (integer) 1
       5) "pending"
       6) (integer) 0
       7) "last-delivered-id"
       8) "1717248597227-0"
       9) "entries-read"
      10) (integer) 0
      11) "lag"
      12) (integer) 1
   kvrocks-server:6666> xgroup delconsumer overflow-test info-count-test consumer-1
   (integer) 1
   kvrocks-server:6666> xinfo groups overflow-test
   Error: Bad integer value
   ```
   
   The redis-cli refuses to display the response value.
   
   So, I use telnet to run the command and got response below.
   
   ```bash
   xinfo groups overflow-test
   *1
   *12
   $4
   name
   $15
   info-count-test
   $9
   consumers
   :0
   $7
   pending
   :18446744073709551615
   $17
   last-delivered-id
   $15
   1717248597227-0
   $12
   entries-read
   :0
   $3
   lag
   :1
   ```
   
   ### What did you expect to see?
   
   This is output from redis-cli.
   
   ```bash
   redis-server:6379>xinfo groups overflow-test
   1)  1) "name"
       2) "info-count-test"
       3) "consumers"
       4) (integer) 0
       5) "pending"
       6) (integer) 0
       7) "last-delivered-id"
       8) "1717249449175-0"
       9) "entries-read"
      10) (integer) 1
      11) "lag"
      12) (integer) 0
   ```
   
   This output from telnet.
   
   ```bash
   xinfo groups overflow-test
   *1
   *12
   $4
   name
   $15
   info-count-test
   $9
   consumers
   :0
   $7
   pending
   :0
   $17
   last-delivered-id
   $15
   1717249449175-0
   $12
   entries-read
   :1
   $3
   lag
   :0
   ```
   
   ### What did you see instead?
   
   redis-cli refuses to display the response.
   
   ```bash
   kvrocks-server:6666> xinfo groups overflow-test
   Error: Bad integer value
   ```
   
   telnet get the response from kvrocks-server.
   
   ```bash
   xinfo groups overflow-test
   *1
   *12
   $4
   name
   $15
   info-count-test
   $9
   consumers
   :0
   $7
   pending
   :18446744073709551615
   $17
   last-delivered-id
   $15
   1717248597227-0
   $12
   entries-read
   :0
   $3
   lag
   :1
   ```
   
   ### Anything Else?
   
   Hi kvrocks team,
   
     I find the way to produce the bug during reading the PR of `XPENDING` #2190 .
   
     In conversations of the PR, it's suggested to use a separate PR to solve this problem.
   
     I want to fix the bug and add related unit tests with it.
   
   Best Regards,
   
   Edward
   
   ### Are you willing to submit a PR?
   
   - [X] 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: issues-unsubscribe@kvrocks.apache.org.apache.org

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


Re: [I] [Bug] XINFO overflow when deleting pending message and consumer [kvrocks]

Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on issue #2350:
URL: https://github.com/apache/kvrocks/issues/2350#issuecomment-2143459682

   @LindaSummer Thanks for your detailed report.


-- 
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


Re: [I] [Bug] XINFO overflow when deleting pending message and consumer [kvrocks]

Posted by "LindaSummer (via GitHub)" <gi...@apache.org>.
LindaSummer commented on issue #2350:
URL: https://github.com/apache/kvrocks/issues/2350#issuecomment-2143780155

   Hi @PragmaTwice ,
   
   I have opened a PR for this bugfix with related test case.
   
   Please take a look.
   
   Thanks very much.


-- 
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


Re: [I] [Bug] XINFO overflow when deleting pending message and consumer [kvrocks]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on issue #2350:
URL: https://github.com/apache/kvrocks/issues/2350#issuecomment-2143483822

   Thank you for your report!
   
   If you know how to fix it, feel free to open 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: issues-unsubscribe@kvrocks.apache.org

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


Re: [I] [Bug] XINFO overflow when deleting pending message and consumer [kvrocks]

Posted by "LindaSummer (via GitHub)" <gi...@apache.org>.
LindaSummer commented on issue #2350:
URL: https://github.com/apache/kvrocks/issues/2350#issuecomment-2143465930

   Hi @git-hulk ,
   
   This should be forget to update the `pending_number` in consumer meta.
   https://github.com/apache/kvrocks/blob/d2e0feb989bd5855480deee61ebf932327e5ca93/src/types/redis_stream.cc#L351-L356
   
   When remove consumer, the group will remove the pending count from the deleted consumer, the inconsistency emerged and may lead to overflow.
   https://github.com/apache/kvrocks/blob/d2e0feb989bd5855480deee61ebf932327e5ca93/src/types/redis_stream.cc#L687-L688
   https://github.com/apache/kvrocks/blob/d2e0feb989bd5855480deee61ebf932327e5ca93/src/types/redis_stream.cc#L717-L720
   


-- 
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


Re: [I] [Bug] XINFO overflow when deleting pending message and consumer [kvrocks]

Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on issue #2350:
URL: https://github.com/apache/kvrocks/issues/2350#issuecomment-2144301775

   @LindaSummer Thanks for your nice catch and 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


Re: [I] [Bug] XINFO overflow when deleting pending message and consumer [kvrocks]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU closed issue #2350: [Bug] XINFO overflow when deleting pending message and consumer
URL: https://github.com/apache/kvrocks/issues/2350


-- 
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