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

[fix][client] Release the orphan producers after the primary consumer is closed #19858

Merged
merged 3 commits into from
Apr 6, 2023

Conversation

poorbarcode
Copy link
Contributor

Motivation

The producers ["retryLetterProducer", "deadLetterProducer"] will be auto-created by consumers if enabled DLQ, but these producers will not close after consumers are closed.

Modifications

Auto close "retryLetterProducer" and "deadLetterProducer" after the primary consumer is closed

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@poorbarcode poorbarcode changed the title [fix] [cli] fix Orphan retry producer after the primary consumer is c… [fix] [cli] Fix orphan retry producer after the primary consumer is closed Mar 20, 2023
@poorbarcode poorbarcode changed the title [fix] [cli] Fix orphan retry producer after the primary consumer is closed [fix] [cli] Fix orphan producers after the primary consumer is closed Mar 20, 2023
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Mar 20, 2023
@poorbarcode poorbarcode changed the title [fix] [cli] Fix orphan producers after the primary consumer is closed [fix] [cli] Release the orphan producers after the primary consumer is closed Mar 20, 2023
@poorbarcode poorbarcode self-assigned this Mar 21, 2023
return closeFuture;
return closeFuture.thenCompose(ignore -> {
if (retryLetterProducer != null){
return retryLetterProducer.closeAsync();
Copy link
Member

@mattisonchao mattisonchao Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we close them parallelly? Do you think we should make some special exception handling here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we close them parallelly?

Fixed.

Do you think we should make some special exception handling here?

Yes, if closing these producers fail, users can not retry to close them again, so just print a warning log. Or two other implementations:

  • Make this method retryable.
  • Do retry these producers' close silently
    Since there are few scenarios where failure occurs, such as when the connection has been broken (no longer necessary to retry the close), just print a warning log.

@Technoboy- Technoboy- added this to the 3.0.0 milestone Mar 23, 2023
@Technoboy- Technoboy- closed this Mar 23, 2023
@Technoboy- Technoboy- reopened this Mar 23, 2023
@lhotari lhotari added type/bug The PR fixed a bug or issue reported a bug release/2.10.5 release/2.11.2 labels Apr 5, 2023
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good catch!

@lhotari lhotari changed the title [fix] [cli] Release the orphan producers after the primary consumer is closed [fix][client] Release the orphan producers after the primary consumer is closed Apr 5, 2023
@lhotari lhotari closed this Apr 5, 2023
@lhotari lhotari reopened this Apr 5, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #19858 (54ad9d7) into master (f20dc93) will increase coverage by 13.05%.
The diff coverage is 87.50%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #19858       +/-   ##
=============================================
+ Coverage     25.11%   38.16%   +13.05%     
- Complexity      205     1364     +1159     
=============================================
  Files          1680     1686        +6     
  Lines        127176   133729     +6553     
  Branches      13863    15400     +1537     
=============================================
+ Hits          31942    51040    +19098     
+ Misses        90242    75961    -14281     
- Partials       4992     6728     +1736     
Flag Coverage Δ
inttests 25.36% <87.50%> (?)
systests 25.17% <21.42%> (+0.05%) ⬆️
unittests 33.13% <75.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rg/apache/pulsar/common/util/URIPreconditions.java 44.44% <0.00%> (+44.44%) ⬆️
...va/org/apache/pulsar/client/impl/ConsumerImpl.java 57.06% <93.33%> (+29.06%) ⬆️

... and 581 files with indirect coverage changes

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@poorbarcode
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@poorbarcode poorbarcode merged commit 94ae340 into apache:master Apr 6, 2023
@poorbarcode poorbarcode deleted the fix/orphan_producer_forretry branch April 6, 2023 04:59
Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I had tried to fix this a long time ago with #10159 but it was never completed.

poorbarcode added a commit that referenced this pull request May 6, 2023
… is closed (#19858)

Motivation: The producers ["retryLetterProducer", "deadLetterProducer"] will be auto-created by consumers if enabled `DLQ`, but these producers will not close after consumers are closed.

Modifications: Auto close "retryLetterProducer" and "deadLetterProducer" after the primary consumer is closed
(cherry picked from commit 94ae340)
poorbarcode added a commit that referenced this pull request May 6, 2023
… is closed (#19858)

Motivation: The producers ["retryLetterProducer", "deadLetterProducer"] will be auto-created by consumers if enabled `DLQ`, but these producers will not close after consumers are closed.

Modifications: Auto close "retryLetterProducer" and "deadLetterProducer" after the primary consumer is closed
(cherry picked from commit 94ae340)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request May 11, 2023
… is closed (apache#19858)

Motivation: The producers ["retryLetterProducer", "deadLetterProducer"] will be auto-created by consumers if enabled `DLQ`, but these producers will not close after consumers are closed.

Modifications: Auto close "retryLetterProducer" and "deadLetterProducer" after the primary consumer is closed
(cherry picked from commit 94ae340)
(cherry picked from commit a0ff522)
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.

7 participants