pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

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

Open lhotari opened this issue 1 year ago • 0 comments

Search before asking

  • [X] I searched in the 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!

lhotari avatar Jun 06 '24 20:06 lhotari