-
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 non partitioned topic consumer call RedeliverUnacknowledgedMessages
cause deadlock.
#18462
Conversation
144d37d
to
43966a1
Compare
@Technoboy- I think the right fix should change public void redeliverUnacknowledgedMessages() {
try {
internalRedeliverUnacknowledgedMessages().get();
} catch (ExecutionException e) {
throw e.getCause();
}
} to public void redeliverUnacknowledgedMessages() {
internalRedeliverUnacknowledgedMessages();
} I'm afraid we will introduce a potential race condition issue if we remove the |
Oh sorry. But it will introduce another problem. Users have completed the |
Codecov Report
@@ Coverage Diff @@
## master #18462 +/- ##
============================================
- Coverage 45.67% 36.18% -9.49%
+ Complexity 10075 7734 -2341
============================================
Files 693 697 +4
Lines 67940 67979 +39
Branches 7273 7278 +5
============================================
- Hits 31030 24600 -6430
- Misses 33333 40076 +6743
+ Partials 3577 3303 -274
Flags with carried forward coverage won't be shown. Click here to find out more.
|
The issue should also happen on a partitioned topic, right? public void redeliverUnacknowledgedMessages() {
List<CompletableFuture<Void>> futures = new ArrayList<>(consumers.size());
internalPinnedExecutor.execute(() -> {
CONSUMER_EPOCH.incrementAndGet(this);
consumers.values().stream().forEach(consumer -> {
futures.add(consumer.internalRedeliverUnacknowledgedMessages());
consumer.unAckedChunkedMessageIdSequenceMap.clear();
});
clearIncomingMessages();
unAckedMessageTracker.clear();
});
try {
FutureUtil.waitForAll(futures).get();
} catch (ExecutionException e) {
throw e.getCause();
}
resumeReceivingFromPausedConsumersIfNeeded();
} |
Close this patch due to the revert of #18475 |
Motivation
#17318 has made
internalRedeliverUnacknowledgedMessages
executed byinternalPinnedExecutor
.If the consumer received msg then call
redeliverUnacknowledgedMessages
like the below :pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Lines 1915 to 1921 in dcf0b60
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Lines 1861 to 1911 in dcf0b60
Modification
internalPinnedExecutor
to executeinternalRedeliverUnacknowledgedMessages
.Documentation
doc
doc-required
doc-not-needed
doc-complete