You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "rdhabalia (via GitHub)" <gi...@apache.org> on 2024/09/03 21:43:26 UTC

[PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

rdhabalia opened a new pull request, #23251:
URL: https://github.com/apache/pulsar/pull/23251

   
   Fixes : https://github.com/apache/pulsar/issues/23250
   
   ### Motivation
   
   [PIP-91](https://github.com/apache/pulsar/pull/11627/) had added a change to accumulate list of Exceptions and attempt for not any good reasons. On connection failure, client lib always logs the exception and error  so, there is always a way to find out any previous exception for the connection issues. and there is no any good reason or standard to keep large number of  exception-list in memory and additionally generate huge huge logs which creates unnecessary string objects and consumes high CPU that eventually makes broker unavailable due to high CPU and high gc pauses.
   
   ### Modifications
   
   Client lib keeps the previous exception list during connection failure which is unnecessary because of two reasons: 
   1) in almost all cases, all previous Exceptions are with same type and same error message as intermittent connection failure and retry happens due to same the issue. 
   2) Client lib always logs the exception so, no need to keep list of previous exception list in memory and user can always track all previous exceptions from the log. 
   however, client lib can still keep the counter for previous-attempt in the exception context to see number of failures/retry and how far user should check in the logs. So, Client lib should remove the in-memory unnecessary previous exception objects to avoid huge logging data-print but still can keep the exception-counter to help users to do debugging in logs.
   
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

Posted by "rdhabalia (via GitHub)" <gi...@apache.org>.
rdhabalia commented on PR #23251:
URL: https://github.com/apache/pulsar/pull/23251#issuecomment-2332815671

   done. I have sent email and will wait for 1-2 days before merging this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #23251:
URL: https://github.com/apache/pulsar/pull/23251#issuecomment-2332547627

   > @lhotari please let me know if we have any additional concerns, or else we can merge this PR.
   
   No other concerns that notifying the dev mailing about changing the public methods of a published class and removing a PIP-91 feature. You could make it a lazy consensus decision from my point and merge it in 24hrs unless someone stops you and has a good reason to block it. Makes sense?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #23251:
URL: https://github.com/apache/pulsar/pull/23251#issuecomment-2327887321

   Thank you @rdhabalia. Good work!
   One of the remaining challenges in addressing the problem is about retaining binary compatibility with previous versions of Pulsar clients. @rdhabalia do you think that there would be a way to make a change where this is achieved?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

Posted by "rdhabalia (via GitHub)" <gi...@apache.org>.
rdhabalia commented on PR #23251:
URL: https://github.com/apache/pulsar/pull/23251#issuecomment-2327935642

   @lhotari 
   `PulsarClientException::toString()` returns a string message; ideally, there is no such contract to maintain the format. in fact, none of the exception message string should have that contract.
   another solution is to add client-configuration to restrict the stacktrace by ignoring storing and printing any previous exception but then it will be really bad design to add a client-configuration which will be used to control Exception toString message format.
   I guess, motivation of introducing previous-Exception to find out number of attempts happened with such exception, and this PR still keeps attempts-value and prints into the toString() method.
   Also, this change should not break any application logic as it prints less information, and any application must handle such information.
   So, I guess this change should not break backward compatibility. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

Posted by "rdhabalia (via GitHub)" <gi...@apache.org>.
rdhabalia merged PR #23251:
URL: https://github.com/apache/pulsar/pull/23251


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #23251:
URL: https://github.com/apache/pulsar/pull/23251#issuecomment-2328099870

   ## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/23251?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `80.76923%` with `5 lines` in your changes missing coverage. Please review.
   > Project coverage is 74.51%. Comparing base [(`bbc6224`)](https://app.codecov.io/gh/apache/pulsar/commit/bbc62245c5ddba1de4b1e7cee4ab49334bc36277?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`5844d47`)](https://app.codecov.io/gh/apache/pulsar/commit/5844d4790e1d4caa19d6b71d31ce6f2e374fa2ad?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 560 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/23251?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...pache/pulsar/client/api/PulsarClientException.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fapi%2FPulsarClientException.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3B1bHNhci9jbGllbnQvYXBpL1B1bHNhckNsaWVudEV4Y2VwdGlvbi5qYXZh) | 57.14% | [2 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...rg/apache/pulsar/client/impl/TopicListWatcher.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FTopicListWatcher.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL1RvcGljTGlzdFdhdGNoZXIuamF2YQ==) | 75.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ulsar/client/impl/TransactionMetaStoreHandler.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FTransactionMetaStoreHandler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL1RyYW5zYWN0aW9uTWV0YVN0b3JlSGFuZGxlci5qYXZh) | 66.66% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/23251/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #23251      +/-   ##
   ============================================
   + Coverage     73.57%   74.51%   +0.94%     
   - Complexity    32624    33741    +1117     
   ============================================
     Files          1877     1926      +49     
     Lines        139502   144980    +5478     
     Branches      15299    15851     +552     
   ============================================
   + Hits         102638   108037    +5399     
   + Misses        28908    28676     -232     
   - Partials       7956     8267     +311     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pulsar/pull/23251/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [inttests](https://app.codecov.io/gh/apache/pulsar/pull/23251/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.89% <38.46%> (+3.30%)` | :arrow_up: |
   | [systests](https://app.codecov.io/gh/apache/pulsar/pull/23251/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.67% <26.92%> (+0.34%)` | :arrow_up: |
   | [unittests](https://app.codecov.io/gh/apache/pulsar/pull/23251/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.86% <80.76%> (+1.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/23251?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...va/org/apache/pulsar/client/impl/ConsumerImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FConsumerImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL0NvbnN1bWVySW1wbC5qYXZh) | `78.78% <100.00%> (+1.21%)` | :arrow_up: |
   | [...va/org/apache/pulsar/client/impl/ProducerImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FProducerImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL1Byb2R1Y2VySW1wbC5qYXZh) | `84.09% <100.00%> (+0.50%)` | :arrow_up: |
   | [...rg/apache/pulsar/client/impl/PulsarClientImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FPulsarClientImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL1B1bHNhckNsaWVudEltcGwuamF2YQ==) | `75.55% <100.00%> (+1.24%)` | :arrow_up: |
   | [...rg/apache/pulsar/client/impl/TopicListWatcher.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FTopicListWatcher.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL1RvcGljTGlzdFdhdGNoZXIuamF2YQ==) | `66.91% <75.00%> (-0.95%)` | :arrow_down: |
   | [...ulsar/client/impl/TransactionMetaStoreHandler.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FTransactionMetaStoreHandler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL1RyYW5zYWN0aW9uTWV0YVN0b3JlSGFuZGxlci5qYXZh) | `66.59% <66.66%> (-1.31%)` | :arrow_down: |
   | [...pache/pulsar/client/api/PulsarClientException.java](https://app.codecov.io/gh/apache/pulsar/pull/23251?src=pr&el=tree&filepath=pulsar-client-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fapi%2FPulsarClientException.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3B1bHNhci9jbGllbnQvYXBpL1B1bHNhckNsaWVudEV4Y2VwdGlvbi5qYXZh) | `61.58% <57.14%> (-1.46%)` | :arrow_down: |
   
   ... and [556 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/23251/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][client] Fix broker/Client CPU reaching 100% during retriable connection failure [pulsar]

Posted by "rdhabalia (via GitHub)" <gi...@apache.org>.
rdhabalia commented on PR #23251:
URL: https://github.com/apache/pulsar/pull/23251#issuecomment-2332412425

   @lhotari please let me know if we have any additional concerns, or else we can merge this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org