apache / apache/pulsar

[Bug] [ml] The readPosition is greater than the lastPosition

Open
#23,673 0 comments 0 reactions 0 assignees View on GitHub
type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Read release policy

- [X] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

### Version

2.9.2

### Minimal reproduce step

Currently, it cannot be reproduced stably.

### What did you expect to see?

readPosition <= lastPosition + 1

### What did you see instead?

readPosition > lastPosition + 1

### Anything else?
The following is an example in a real scenario:
The topic max ledger is 35992528, but the readPosition ledger has reached 36641783.
![Clipboard_Screenshot_1733212505](https://github.com/user-attachments/assets/50b515d7-7634-4ab0-9dc6-af5d70bdeb3a)
![Clipboard_Screenshot_1733212537](https://github.com/user-attachments/assets/0963aba0-5fa5-4dbb-99a9-3839f7de2c5a)

The problem we encountered is relatively similar to the one here:
https://github.com/apache/pulsar/pull/17454

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the readPosition and lastPosition behavior described in this issue and compare it with Apache Pulsar pull request #17454. Attempt reproduction on the stated Pulsar 2.9.2 version, then trace the relevant managed-ledger or consumer code once the failing path is identified. Done means the cause is established and the readPosition invariant is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.