[Bug] readNext() hangs if you configure a Pulsar Reader with MessageId.earliest and seek() before reading
- 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
Pulsar 3
### Minimal reproduce step
If you create a reader like so
```
var partitionReader: Reader? =
client
.newReader(BYTES)
.startMessageId(MessageId.earliest)
.topic(topic)
.create()
```
then call seek to some timestamp that is certainly within a valid range of time where there are messages after
```
pulsarReader.seek(timestamp)
```
readNext() will hang.
```
if (!pulsarReader.hasMessageAvailable()) {
logger.info("No messages from this starting timestamp")
return null
}
var nextMsg = pulsarReader.readNext()
```
### What did you expect to see?
readNext() returns the next message, or hasMessageAvailable() returns false
### What did you see instead?
hangs
### Anything else?
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
Research direction
Reproduce the issue using a Pulsar Reader configured with MessageId.earliest, then call seek(timestamp) before hasMessageAvailable() and readNext(). Trace the Reader behavior around those entry points and compare the expected next-message or false result with the hang. Done means the reproduction no longer hangs and returns the next message or reports no available message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100