Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Messages lost if a multi-topics consumer does not receive all messages after seek #22208

Open
2 tasks done
BewareMyPower opened this issue Mar 6, 2024 · 2 comments
Open
2 tasks done

Comments

@BewareMyPower
Copy link
Contributor

BewareMyPower commented Mar 6, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Version

master (207335a)

Minimal reproduce step

Add Thread.sleep(100); after

Then, run testSeekCustomTopicMessageId

What did you expect to see?

The test should pass

What did you see instead?

The test is blocked because not all messages are received.

Anything else?

The reason is the current seek behavior of a multi-topics consumer.

Since #19158, a TopicMessageId can be accepted by a seek call on a multi-topics consumer. In this case, the consumer will perform seek operation on a specific internal consumer and other internal consumers are not affected.

However, since all incoming messages will be cleared before a seek operation, there is a race that some of them are not received by consumer before the next seek operation.

For example, given a multi-topics consumer that subscribes topic1, topic2, topic3 and each topic has 5 messages.

  • topic1: 0,1,2
  • topic2: 3,4,5
  1. Consumer seeks to 1 on topic1. Then the internal consumer will receiving from 2.
  2. Wait for a while, incomingMessages might become [2] because internal consumer on topic1 could pre-fetch the message 2.
  3. Consumer seeks to 4 on topic2.

After that, consumer could only receive [5] because message 2 was pre-fetched in step 2 and cleared in topic2.

From expectations of users, they have sought to topic1: 1 and topic2:4, so after that, they should receive [2, 5] rather than [5].

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@lhotari
Copy link
Member

lhotari commented Jan 16, 2025

@BewareMyPower is this fixed by #22201 ? Please close if it is.

@BewareMyPower
Copy link
Contributor Author

#22201 does not fix this issue. I just found this bug when I found testSeekCustomTopicMessageId failed in that PR.

See #22201 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants