-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Broker] Avoid thread deadlock problem when creating topic policy reader #13837
Merged
codelipenghui
merged 5 commits into
apache:master
from
gaoran10:gaoran/fix-sync-reader-creation-topic-policies
Jan 20, 2022
Merged
[Broker] Avoid thread deadlock problem when creating topic policy reader #13837
codelipenghui
merged 5 commits into
apache:master
from
gaoran10:gaoran/fix-sync-reader-creation-topic-policies
Jan 20, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…d deadlock problem
gaoran10
requested review from
315157973,
hangc0276,
Technoboy-,
codelipenghui,
congbobo184,
eolivelli and
merlimat
January 19, 2022 12:02
codelipenghui
approved these changes
Jan 19, 2022
merlimat
approved these changes
Jan 19, 2022
Technoboy-
reviewed
Jan 19, 2022
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/RetryUtilTest.java
Outdated
Show resolved
Hide resolved
315157973
reviewed
Jan 19, 2022
pulsar-client/src/main/java/org/apache/pulsar/client/util/RetryUtil.java
Show resolved
Hide resolved
hangc0276
approved these changes
Jan 19, 2022
315157973
approved these changes
Jan 20, 2022
Technoboy-
approved these changes
Jan 20, 2022
codelipenghui
pushed a commit
that referenced
this pull request
Jan 20, 2022
…der (#13837) Currently, the topic policy reader creation thread is the `executor` of the `PulsarService`, this thread is also used to search the candidate broker. If they use the same thread in some conditions, the lookup request will be blocked and result in a lookup request timeout. ![image](https://user-images.githubusercontent.com/15029908/150124902-c4318182-56f2-4b31-9149-ae64a9919aa4.png) ![image](https://user-images.githubusercontent.com/15029908/150124952-66a9f095-bab2-40fa-9370-76d3f2158dac.png) We could find out that the lookup request was blocked 1 minute until the lookup request timeout. The thread `pulsar-2-8` was blocked by topic policy reader creation. Change the topic policy reader creation to be asynchronous. Modify the method `RetryUtil.retryAsynchronously` to handle asynchronous execution. Add a new test to verify consumer creations can be successful when enabling the topic policy feature. (cherry picked from commit 760bfec)
codelipenghui
pushed a commit
that referenced
this pull request
Jan 21, 2022
…der (#13837) Currently, the topic policy reader creation thread is the `executor` of the `PulsarService`, this thread is also used to search the candidate broker. If they use the same thread in some conditions, the lookup request will be blocked and result in a lookup request timeout. ![image](https://user-images.githubusercontent.com/15029908/150124902-c4318182-56f2-4b31-9149-ae64a9919aa4.png) ![image](https://user-images.githubusercontent.com/15029908/150124952-66a9f095-bab2-40fa-9370-76d3f2158dac.png) We could find out that the lookup request was blocked 1 minute until the lookup request timeout. The thread `pulsar-2-8` was blocked by topic policy reader creation. Change the topic policy reader creation to be asynchronous. Modify the method `RetryUtil.retryAsynchronously` to handle asynchronous execution. Add a new test to verify consumer creations can be successful when enabling the topic policy feature. (cherry picked from commit 760bfec)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-2.8
Archived: 2.8 is end of life
cherry-picked/branch-2.9
Archived: 2.9 is end of life
doc-not-needed
Your PR changes do not impact docs
release/2.8.3
release/2.9.2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, the topic policy reader creation thread is the
executor
of thePulsarService
, this thread is also used to search the candidate broker. If they use the same thread in some conditions, the lookup request will be blocked and result in a lookup request timeout.We could find out that the lookup request was blocked 1 minute until the lookup request timeout. The thread
pulsar-2-8
was blocked by topic policy reader creation.Modifications
Change the topic policy reader creation to be asynchronous. Modify the method
RetryUtil.retryAsynchronously
to handle asynchronous execution.Verifying this change
Add a new test to verify consumer creations can be successful when enabling the topic policy feature.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below or label this PR directly (if you have committer privilege).
Need to update docs?
doc-required
(If you need help on updating docs, create a doc issue)
no-need-doc
(Please explain why)
doc
(If this PR contains doc changes)