-
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] Prevent retry topic and dead letter topic producer leaks when sending of message fails #23824
[fix][client] Prevent retry topic and dead letter topic producer leaks when sending of message fails #23824
Conversation
…ry topic message sending fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a small comment.
And I have question about retry create deadletterProducer or retryProducer.
- For schema exceptions mentioned in the ticket, retries won't solve the issue, right? So what's the point?
- If there are network issues, the Producer has automatic retries internally.
I'm wondering why we need to implement a retry mechanism here, or why the original logic sets the deadletterProducer=null
. If creation truly fails, shouldn't the user handle it?
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Show resolved
Hide resolved
Thanks for the review feedback, @shibd. Correct. This PR doesn't try to resolve that. The point is that it's a way to reproduce the issue reported in #20635 (comment) . The test case has that comment too, but I guess I should have been more verbose about it.
That's a valid point. The original intention of this PR was to address the producer leak without changing the existing logic. However, the original logic is not great in the first place when a new producer is created whenever an exception happens in message sending. |
hi, @lhotari Thanks for the discussion. So, can we directly remove the logic that sets pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java Line 729 in 109f042
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java Line 2240 in 109f042
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java Line 752 in 109f042
This would simplify things, as re-create doesn't seem very meaningful to me. |
@shibd Sure, that's a question that comes into mind. There seems to be a reason why it has been reset to |
9500a90
to
678aadf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/LGTM
…s when sending of message fails (apache#23824) (cherry picked from commit 04e89fe) (cherry picked from commit b6beb90)
Fixes #20635
Motivation
The client currently leaks producers when sending of the message fails and a new producer is created after an exception occurs. The previous producer wasn't closed in these cases.
In case of such failures, there should be a retry backoff so that such cases don't cause excessive load on the broker side.
Modifications
Documentation
doc
doc-required
doc-not-needed
doc-complete