Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONSUMER.LIST API doesn't return correct total size #4425

Closed
elvis-xianghai-fan opened this issue Aug 24, 2023 · 2 comments
Closed

CONSUMER.LIST API doesn't return correct total size #4425

elvis-xianghai-fan opened this issue Aug 24, 2023 · 2 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@elvis-xianghai-fan
Copy link

What version were you using?

Server info: (returned by nats server info)

Process Details:

         Version: 2.9.19
      Git Commit: f4f3cce
      Go Version: go1.19.10
      Start Time: 2023-08-23 16:31:54.813747306 +0000 UTC
          Uptime: 8h55m45s

Client (nats-cli) info:

➜  ~ nats --version
0.0.34

What environment was the server running in?

Kubernetes (GKE version 1.24.14-gke.2700)

Is this defect reproducible?

Yes. To reproduce:

  1. Create a new stream with the given json file.
nats stream add fantest-stream-3 --config test-stream.json

test-stream.json:

{
  "name": "fantest-stream-3",
  "subjects": [
    "fantest-stream-3.*"
  ],
  "retention": "workqueue",
  "max_consumers": -1,
  "max_msgs_per_subject": -1,
  "max_msgs": -1,
  "max_bytes": -1,
  "max_age": 0,
  "max_msg_size": -1,
  "storage": "file",
  "discard": "old",
  "num_replicas": 1,
  "duplicate_window": 120000000000,
  "sealed": false,
  "deny_delete": false,
  "deny_purge": false,
  "allow_rollup_hdrs": false,
  "allow_direct": false,
  "mirror_direct": false
}
  1. Create 260 consumers in the stream.
for i in {1..260}
do
  nats consumer add --pull --filter="fantest-stream-3.fantest-consumer-$i" \
    --deliver=all --ack=explicit --replay=instant --replicas=1 \
    --max-deliver=-1 --max-pending=1000 --no-headers-only --backoff=linear \
    fantest-stream-3 fantest-consumer-$i
done
  1. Request $JS.API.CONSUMER.LIST.fantest-stream-3. It says total is 256.
nats request '$JS.API.CONSUMER.LIST.fantest-stream-3' ''
14:32:54 Sending request on "$JS.API.CONSUMER.LIST.fantest-stream-3"
14:32:55 Received with rtt 1.135441952s
{"type":"io.nats.jetstream.api.v1.consumer_list_response","total":256,"offset":0,"limit":256,"consumers":[......
  1. nats consumer ls fantest-stream-3 can list all the 260 consumers.

Given the capability you are leveraging, describe your expectation?

nats request '$JS.API.CONSUMER.LIST.fantest-stream-3' '' should return the correct total size.

Given the expectation, what is the defect you are observing?

The API returning incorrect total size causes our code (which uses the go and python libs) to not get the full list of consumers.

@elvis-xianghai-fan elvis-xianghai-fan added the defect Suspected defect such as a bug or regression label Aug 24, 2023
@ripienaar
Copy link
Contributor

Fixed in 2.9.21

#4339

@elvis-xianghai-fan
Copy link
Author

Oh, I didn't know that. Thanks. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants