You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "lhotari (via GitHub)" <gi...@apache.org> on 2025/04/25 13:17:20 UTC
[PR] [fix][broker] Fix HealthChecker deadlock in shutdown [pulsar]
lhotari opened a new pull request, #24216:
URL: https://github.com/apache/pulsar/pull/24216
Fixes #24215
### Motivation
Follow up on #24210 which extracted the health checker logic to a separate class, HealthChecker.
There's a dead lock in broker shutdown and this PR addresses the issue.
### Modifications
- add a separate single threaded executor for executing health check operations and asynchronous callbacks
- this fixes the dead lock issue
- this avoids running health check operations on metadata or Pulsar internal threads
- add other minor cleanup and improvements
- set the send timeout
- disable batching for the producer
### 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 -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
--
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][broker] Fix HealthChecker deadlock in shutdown [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn commented on code in PR #24216:
URL: https://github.com/apache/pulsar/pull/24216#discussion_r2060362387
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/HealthChecker.java:
##########
@@ -321,10 +344,20 @@ public synchronized void close() throws Exception {
}
for (CompletableFuture<Void> pendingFuture : new ArrayList<>(pendingFutures)) {
if (!pendingFuture.isDone()) {
- pendingFuture.completeExceptionally(
- new PulsarClientException.AlreadyClosedException("HealthChecker is closed"));
+ healthCheckExecutor.submit(() -> {
Review Comment:
Do we need to complete this on a separate thread?
--
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][broker] Fix HealthChecker deadlock in shutdown [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #24216:
URL: https://github.com/apache/pulsar/pull/24216
--
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][broker] Fix HealthChecker deadlock in shutdown [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #24216:
URL: https://github.com/apache/pulsar/pull/24216#discussion_r2060411806
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/HealthChecker.java:
##########
@@ -321,10 +344,20 @@ public synchronized void close() throws Exception {
}
for (CompletableFuture<Void> pendingFuture : new ArrayList<>(pendingFutures)) {
if (!pendingFuture.isDone()) {
- pendingFuture.completeExceptionally(
- new PulsarClientException.AlreadyClosedException("HealthChecker is closed"));
+ healthCheckExecutor.submit(() -> {
Review Comment:
Just to be consistent, it's done this way. It's not harmful. :)
--
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][broker] Fix HealthChecker deadlock in shutdown [pulsar]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24216:
URL: https://github.com/apache/pulsar/pull/24216#issuecomment-2830613263
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/24216?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 `78.26087%` with `10 lines` in your changes missing coverage. Please review.
> Project coverage is 74.21%. 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 [(`65e2206`)](https://app.codecov.io/gh/apache/pulsar/commit/65e2206d5948bd31c9603ae943c12671e26051d0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 1044 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/24216?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...rg/apache/pulsar/broker/service/HealthChecker.java](https://app.codecov.io/gh/apache/pulsar/pull/24216?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Fservice%2FHealthChecker.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL0hlYWx0aENoZWNrZXIuamF2YQ==) | 78.26% | [9 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/pulsar/pull/24216?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>
[](https://app.codecov.io/gh/apache/pulsar/pull/24216?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #24216 +/- ##
============================================
+ Coverage 73.57% 74.21% +0.63%
+ Complexity 32624 32533 -91
============================================
Files 1877 1866 -11
Lines 139502 144769 +5267
Branches 15299 16535 +1236
============================================
+ Hits 102638 107439 +4801
+ Misses 28908 28830 -78
- Partials 7956 8500 +544
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/24216/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/24216/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.70% <67.39%> (+2.12%)` | :arrow_up: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/24216/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `23.30% <0.00%> (-1.03%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/24216/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.70% <78.26%> (+0.85%)` | :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/24216?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...rg/apache/pulsar/broker/service/HealthChecker.java](https://app.codecov.io/gh/apache/pulsar/pull/24216?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Fservice%2FHealthChecker.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL0hlYWx0aENoZWNrZXIuamF2YQ==) | `69.87% <78.26%> (ø)` | |
... and [1083 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/24216/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</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