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

[fix] [client] Messages lost due to TopicListWatcher reconnect #21853

Merged
merged 12 commits into from
Jan 8, 2024

Conversation

poorbarcode
Copy link
Contributor

Motivation

Issue

  • Start a consumer subscribe with regexp public/default/*
  • Create a new topic public/default/tp-1
  • Send messages to the new topic
  • Consumers will not receive any messages, and the messages will be deleted due to there are no subscription.

Root cause

Case-1:

Time Thread start consumer Thread create topic
1 Start subscribe
2 Start to register TopicListWatcher Create new topic
3 Topic created
4 Since there are no listeners registered, there is no need to notice clients
5 TopicListWatcher registered, the consumer will not receive any messages from the new topic

Case-2:

Time Thread TopicListWatcher reconnect Thread create topic
1 Start reconnect
2 Create new topic
3 Topic created
4 Since there are no listeners registered, there is no need to notice clients
5 TopicListWatcher reconnected
6 The consumer will not receive any messages from the new topic

This issue only affects the releases >=3.1, because before 3.1 there is a supplementary mechanism scheduled recheckPatternTimeout, it makes the issues will not occur. This supplementary mechanism was removed at 3.1, see #20779

Modifications

  • After TopicListWatcher reconnected, re-check the topics list.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: x

@poorbarcode poorbarcode self-assigned this Jan 4, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 4, 2024
@poorbarcode poorbarcode added type/bug The PR fixed a bug or issue reported a bug category/reliability The function does not work properly in certain specific environments or failures. e.g. data lost release/3.1.3 and removed doc-not-needed Your PR changes do not impact docs labels Jan 4, 2024
@poorbarcode poorbarcode added this to the 3.3.0 milestone Jan 4, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 4, 2024
protected NamespaceName namespaceName;
private volatile Timeout recheckPatternTimeout = null;
private volatile AtomicReference<Timeout> retryRecheckPatternTask = new AtomicReference<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recheckPatternTask is better

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Technoboy- Technoboy- merged commit 042e769 into apache:master Jan 8, 2024
47 checks passed
@Technoboy- Technoboy- modified the milestones: 3.3.0, 3.2.0 Jan 8, 2024
poorbarcode added a commit that referenced this pull request Jan 15, 2024
poorbarcode added a commit that referenced this pull request Jan 15, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 1, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 6, 2024
poorbarcode added a commit that referenced this pull request Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/reliability The function does not work properly in certain specific environments or failures. e.g. data lost cherry-picked/branch-2.11 cherry-picked/branch-3.0 cherry-picked/branch-3.1 doc-not-needed Your PR changes do not impact docs release/2.11.5 release/3.0.3 release/3.1.3 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants