nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

JetStream: incorrect consumer num_pending against stream with subjects ending in `.>`

Open scottf opened this issue 1 year ago • 3 comments

Observed behavior

A new generic consumer reports more num_pending than actual messages in the stream.

Expected behavior

The consumer reports the correct num_pending.

Server version

2.10.10 or later. (Tested against 2.10.9 the information was reported correctly)

Steps to reproduce

Create a consumer against attached data, nats consumer create give it a name and all defaults. Look at the consumer info, it shows "Unprocessed Messages: 5,803". There are only 5670 messages.

Notes

All subjects end with .> (dot greater) as in OrchestrationStream_08fa7d3dcd644745bace255d2c76fbc2.>

Data

nats_cache.zip stree_wildcard.zip

scottf avatar Jun 28 '24 19:06 scottf

Originally reported as a discussion in the Java repo: https://github.com/nats-io/nats.net/discussions/905

scottf avatar Jun 28 '24 19:06 scottf

Can this be re-produced against main?

derekcollison avatar Jun 28 '24 21:06 derekcollison

Can this be re-produced against main?

I used the data with 2.10.17 the first time I was able to reproduce it. I only checked the older versions after Wally explained to me about stree and so I just tested starting with the version he suggested until I found the one it stopped working in.

scottf avatar Jun 28 '24 22:06 scottf

Have figured out the problem. The stree Match was firing the callback twice for OrchestrationStream_08fa7d3dcd644745bace255d2c76fbc2.>, which had 133 messages, and 5803-133=5670. Posted a PR to fix it.

neilalexander avatar Jul 01 '24 10:07 neilalexander