apache / apache/pulsar

[Bug][client] Consumer implementation might change message processing order when ack timeout is set

Open
#22,863 0 comments 0 reactions 1 assignee Claimed by @crossoverJie 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

master

### Minimal reproduce step

Analysed by looking at code in MultiTopicsConsumerImpl

https://github.com/apache/pulsar/blob/fb80007a47deaadb82d0b1b1e4fcd6ca04c05c9c/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java#L889-L911

and ConsumerImpl

https://github.com/apache/pulsar/blob/fb80007a47deaadb82d0b1b1e4fcd6ca04c05c9c/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L2703-L2728

### What did you expect to see?

Message ordering shouldn't change.

### What did you see instead?

A random message gets pulled out of the queue and it is requested for redelivery. Message ordering could change, let's say when Key_Shared is used, this is a problem. There are also other problems in this code since this logic races with message consuming by the application or message listener.

### Anything else?

_No response_

### Are you willing to submit a PR?

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.