BewareMyPower opened a new issue, #24559: URL: https://github.com/apache/pulsar/issues/24559
### Search before reporting - [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](https://pulsar.apache.org/contribute/release-policy/#supported-versions) don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker. ### User environment 4.0.5.3 ### Issue Description When I checked `SystemTopicBasedTopicPoliciesService#readerCaches`, I found a namespace's reader on `__change_events` topic has a strange state. <img width="799" height="481" alt="Image" src="https://github.com/user-attachments/assets/c55390d8-7205-4a91-b650-913f9ffbb752" /> `incomingMessages` is empty, which means all messages have been received. However, `lastMessageIdInBroker` is `3501:2`, while `lastDequeuedMessageId` is `3721:4`. It's strange for this case, because the topic policies service uses a `hasMoreEventsAsync` and `readNextAsync` loop: https://github.com/apache/pulsar/blob/a378bdcbe87efdc3b422f462192b04bb510179c3/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java#L460-L469 If the loop exits, the last call should be `hasMoreEventsAsync`, which must have retrieved the latest last message id as `lastMessageIdInBroker` ### Error messages ```text ``` ### Reproducing the issue n/a ### Additional information _No response_ ### Are you willing to submit a PR? - [ ] 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: commits-unsubscr...@pulsar.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org