Skip to content

Don't try to subscribe to the topic if the consumer is closed.#7589

Merged
wolfstudy merged 3 commits into
apache:masterfrom
codelipenghui:penghui/race_close_consumer
Jul 28, 2020
Merged

Don't try to subscribe to the topic if the consumer is closed.#7589
wolfstudy merged 3 commits into
apache:masterfrom
codelipenghui:penghui/race_close_consumer

Conversation

@codelipenghui

Copy link
Copy Markdown
Contributor

Fixes #7559

Motivation

Fix race condition on the close consumer while reconnecting to the broker.

The race condition happens while the consumer reconnects to the broker, the cnx of the consumer set to null when reconnects to the broker.

If close the consumer at this time, the client will not send close consumer command to the broker

So, if the consumer reconnected to the broker, the consumer will send the subscribe command again.

Modifications

Add state check when connection opened of the consumer. If the consumer state is closing or closed, we don’t need to send the subscribe command

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

@codelipenghui codelipenghui changed the title Fix race condition on the close consumer while reconnecting to the broker. [WIP] Fix race condition on the close consumer while reconnecting to the broker. Jul 18, 2020
@codelipenghui codelipenghui changed the title [WIP] Fix race condition on the close consumer while reconnecting to the broker. Fix race condition on the close consumer while reconnecting to the broker. Jul 18, 2020
@codelipenghui

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui codelipenghui self-assigned this Jul 20, 2020
@codelipenghui codelipenghui added this to the 2.7.0 milestone Jul 20, 2020
@codelipenghui

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@codelipenghui

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui codelipenghui requested review from merlimat and sijie July 21, 2020 14:28
@codelipenghui codelipenghui changed the title Fix race condition on the close consumer while reconnecting to the broker. Don't try to subscribe to the topic if the consumer is closed. Jul 21, 2020
@codelipenghui

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

2 similar comments
@codelipenghui

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@wolfstudy

Copy link
Copy Markdown
Member

/pulsarbot run-failure-checks

@wolfstudy wolfstudy merged commit 0b37b0c into apache:master Jul 28, 2020
wolfstudy pushed a commit that referenced this pull request Jul 29, 2020
### Modifications

Add state check when connection opened of the consumer. If the consumer state is closing or closed, we don’t need to send the subscribe command

(cherry picked from commit 0b37b0c)
@codelipenghui codelipenghui deleted the penghui/race_close_consumer branch August 3, 2020 05:03
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
…he#7589)

### Modifications

Add state check when connection opened of the consumer. If the consumer state is closing or closed, we don’t need to send the subscribe command
lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Sep 5, 2020
…he#7589)

### Modifications

Add state check when connection opened of the consumer. If the consumer state is closing or closed, we don’t need to send the subscribe command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Health Check Topic growth

4 participants