-
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
[fix][client] Fix deadlock when sending chunked messages with BlockIFQueueFull enabled #17795
Merged
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
…QueueFull enabled Signed-off-by: Zike Yang <[email protected]>
RobertIndie
commented
Sep 22, 2022
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
Show resolved
Hide resolved
codelipenghui
approved these changes
Oct 10, 2022
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/MessageChunkingTest.java
Show resolved
Hide resolved
…ageChunkingTest.java Co-authored-by: Penghui Li <[email protected]>
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/MessageChunkingTest.java
Outdated
Show resolved
Hide resolved
BewareMyPower
requested changes
Oct 10, 2022
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/MessageChunkingTest.java
Outdated
Show resolved
Hide resolved
BewareMyPower
requested changes
Oct 10, 2022
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
Show resolved
Hide resolved
BewareMyPower
requested changes
Oct 10, 2022
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
Show resolved
Hide resolved
Signed-off-by: Zike Yang <[email protected]>
BewareMyPower
approved these changes
Oct 11, 2022
Signed-off-by: Zike Yang <[email protected]>
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/client
doc-not-needed
Your PR changes do not impact docs
ready-to-test
type/bug
The PR fixed a bug or issue reported a bug
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.
Fixes #17446
Motivation
When the
isBlockIfQueueFull
is enabled for the producer, if the producer sends a very large message(# of total chunks > maxPendingMessages) or the producer sends too many large messages concurrently, there will be deadlock when the producer tries too acquire the permit before publishing these messages.The root cause is that the producer will try to acquire all permits for all chunks before publishing them. It will be blocked if there are not enough permits. For example, if the payload size of the message is 55 MB which will be split into 11 chunks and the maxPendingMessages size is 10, it will be blocked forever. Even if the message is not too large(like 30MB) but sends 5 such messages concurrently, it may also be blocked forever.
Modifications
BlockIfQueueFull
is enabled, the producer will only acquire a single permit for each chunk before publishing them.This PR only affects the case of
BlockIfQueueFull
enabled when sending chunked messages, and it will not affect other existing behaviors.Verifying this change
This change added tests.
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc-required
(Your PR needs to update docs and you will update later)
doc-not-needed
(Please explain why)
doc
(Your PR contains doc changes)
doc-complete
(Docs have been already added)
Matching PR in forked repository
PR in forked repository: RobertIndie#5