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

[Issue 7168][C++] Fix pattern consumer's deadlock for topics auto discovery #7206

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

BewareMyPower
Copy link
Contributor

@BewareMyPower BewareMyPower commented Jun 8, 2020

Fixes #7168

Motivation

When a pattern consumer is blocked by receive(), the mutex_ will be held until new messages arrived. If the auto discovery timer task found new topics and tried to subscribe them, mutex_ must be acquired first, then the deadlock happened.

Modifications

  • Release the mutex_ after the consumer's state was verified.
  • Change unit tests to verify that new topics could be subscribed when the consumer's blocked by receive(Message&) or receive(Message&, int) methods.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as BasicEndToEndTest.testPatternMultiTopicsConsumerAutoDiscovery.

@BewareMyPower
Copy link
Contributor Author

/pulsarbot run-failure-checks

@jiazhai
Copy link
Member

jiazhai commented Jun 9, 2020

/pulsarbot run-failure-checks

@BewareMyPower BewareMyPower changed the title [C++] Fix pattern consumer's deadlock for topics auto discovery [Issue 7168][C++] Fix pattern consumer's deadlock for topics auto discovery Jun 9, 2020
@sijie sijie added this to the 2.7.0 milestone Jun 9, 2020
@sijie sijie merged commit c2759be into apache:master Jun 9, 2020
@codelipenghui codelipenghui modified the milestones: 2.7.0, 2.6.0 Jun 9, 2020
cdbartholomew pushed a commit to kafkaesque-io/pulsar that referenced this pull request Jul 24, 2020
…auto discovery (apache#7206)

Fixes apache#7168 

### Motivation

When a pattern consumer is blocked by `receive()`, the `mutex_` will be held until new messages arrived. If the auto discovery timer task found new topics and tried to subscribe them, `mutex_` must be acquired first, then the deadlock happened.

### Modifications

- Release the `mutex_` after the consumer's state was verified.
- Change unit tests to verify that new topics could be subscribed when the consumer's blocked by `receive(Message&)` or `receive(Message&, int)` methods.

### Verifying this change

- [ ] Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as *BasicEndToEndTest.testPatternMultiTopicsConsumerAutoDiscovery*.
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
…auto discovery (apache#7206)

Fixes apache#7168 

### Motivation

When a pattern consumer is blocked by `receive()`, the `mutex_` will be held until new messages arrived. If the auto discovery timer task found new topics and tried to subscribe them, `mutex_` must be acquired first, then the deadlock happened.

### Modifications

- Release the `mutex_` after the consumer's state was verified.
- Change unit tests to verify that new topics could be subscribed when the consumer's blocked by `receive(Message&)` or `receive(Message&, int)` methods.

### Verifying this change

- [ ] Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as *BasicEndToEndTest.testPatternMultiTopicsConsumerAutoDiscovery*.
@BewareMyPower BewareMyPower deleted the regexsub-deadlock-dev branch April 30, 2021 08:24
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.

regex subscription not working for new topics in Python
4 participants