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

Getting consumer pending messages count is inconsistent #5367

Open
MENNAELMESALMY opened this issue Apr 30, 2024 · 3 comments
Open

Getting consumer pending messages count is inconsistent #5367

MENNAELMESALMY opened this issue Apr 30, 2024 · 3 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@MENNAELMESALMY
Copy link

Observed behavior

I have a Jetstream that we add and delete messages from, on startup we want to get the count of messages in the stream as follows:

var currentCount = sub.GetConsumerInformation().CalculatedPending;

We noticed that this sometimes returns a count more than the actual messages in the stream so for example, we see it returning 1882 while the stream only contains 1867 messages, we checked the count with nats stream info <stream-name> and it had indeed only 1867.
Also, we check for the last message with msg.MetaData.NumPending == 0 but we observed it having it set to 15 when in indeed it was the last message on the stream as per the cli nats sub <subject-name> --last-per-subject.
Setting the ackpolicy to .WithAckPolicy(AckPolicy.None) makes it return the correct count for some reason.

Expected behavior

The returned pending messages count is consistent with the message count in the stream.

Server and client version

Server version: 2.9.16
Client version (c# client): 1.0.4

Host environment

No response

Steps to reproduce

No response

@MENNAELMESALMY MENNAELMESALMY added the defect Suspected defect such as a bug or regression label Apr 30, 2024
@ripienaar
Copy link
Contributor

You are running a very old server and there have been 100s of bug fixes since.

Please let us know if this is still happening after you upgrade to latest.

@MENNAELMESALMY
Copy link
Author

will do, Thanks!
do you know of any particular fixed bug that can result in this behavior?

@ripienaar
Copy link
Contributor

You can look through the changelog to see, it's not worth diagnosing bugs on such old versions at this point and so I wouldn't be certain which of the many fixes would impact you.

So to help us help you, please upgrade.

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