zhouyifan279 opened a new issue, #24737: URL: https://github.com/apache/pulsar/issues/24737
### 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 Broker version: 3.1.1 ### Issue Description In [KoP Test `OffsetResetTest#testLessThanStartOffset`](https://github.com/zhouyifan279/kop/blob/4059df04e35817908f3fe549894f91986aaf1b1a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/OffsetResetTest.java#L182), there is a test case: 1. Trim Topic ledger 2. Send 5 messages to Topic. 3. Set consumer offset to 0. 4. Consume messages from Topic. Expect consumed message num to be 5. But some times, actual consumed message num is 0. After debugging, I found it is related to pulsar NonDurableCursor. ### Error messages ```text ``` ### Reproducing the issue Run [KoP Test `OffsetResetTest#testLessThanStartOffset`](https://github.com/zhouyifan279/kop/blob/4059df04e35817908f3fe549894f91986aaf1b1a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/OffsetResetTest.java#L182). A machine with high load may increase the chances to reproduce. Or run [NonDurableCursorTest#testOpenNonDurableCursorWhileLedgerIsAddingFirstEntryAfterTrimmed](https://github.com/zhouyifan279/pulsar/blob/83c9199c2d8ac5559900df405b8bc994c0bc9e62/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/NonDurableCursorTest.java#L113). ### Additional information _No response_ ### Are you willing to submit a PR? - [x] 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