You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "tiny-rain (via GitHub)" <gi...@apache.org> on 2023/04/18 02:51:26 UTC
[GitHub] [pulsar] tiny-rain opened a new pull request, #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
tiny-rain opened a new pull request, #20122:
URL: https://github.com/apache/pulsar/pull/20122
<!--
### Contribution Checklist
- PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://pulsar.apache.org/contribute/develop-semantic-title/)*.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
-->
<!-- Either this PR fixes an issue, -->
Fixes #[20105](https://github.com/apache/pulsar/issues/20105)
### Motivation
The deadlock is caused by the different acquiring lock order in zkwatcher callback and connection check thread in zkSessionWatcher. Meanwhile, the lock of ZkSessionWatch is intending to project the currentStatus field, no need to perform a lock operation when executing checkConnectionStatus method.
### Modifications
1. don't perform a lock operation in ZKSessionWatcher.checkConnectionStatus method, which runs in single thread.
2. perform a lock operation in ZKSessionWatcher.checkStatus method.
### Verifying this change
- [x] Make sure that the change passes the CI checks.
This change is a trivial rework / code cleanup without any test coverage.
### 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 -->
- [x] `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
[GitHub] [pulsar] michaeljmarshall commented on pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#issuecomment-1610271584
As discussed on the mailing list https://lists.apache.org/thread/w4jzk27qhtosgsz7l9bmhf1t7o9mxjhp, there is no plan to release 2.9.6, so I am going to remove the release/2.9.6 label
--
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
[GitHub] [pulsar] tiny-rain commented on a diff in pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "tiny-rain (via GitHub)" <gi...@apache.org>.
tiny-rain commented on code in PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#discussion_r1170847090
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java:
##########
@@ -81,7 +83,8 @@ public void close() throws Exception {
}
// task that runs every TICK_TIME to check zk connection
- private synchronized void checkConnectionStatus() {
+ @VisibleForTesting
Review Comment:
it not used, let me remove it.
--
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
[GitHub] [pulsar] tiny-rain commented on pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "tiny-rain (via GitHub)" <gi...@apache.org>.
tiny-rain commented on PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#issuecomment-1515756871
@mattisonchao can the CI re-run again , i check the failed 2 failing check is caused by : Unknown host repo.maven.apache.org: Name or service not known
--
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
[GitHub] [pulsar] Technoboy- commented on pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- commented on PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#issuecomment-1512396428
Could you provide the the dump file or thread stacktrace ?
--
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
[GitHub] [pulsar] Technoboy- merged pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- merged PR #20122:
URL: https://github.com/apache/pulsar/pull/20122
--
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
[GitHub] [pulsar] mattisonchao commented on a diff in pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#discussion_r1169469626
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java:
##########
@@ -81,7 +83,8 @@ public void close() throws Exception {
}
// task that runs every TICK_TIME to check zk connection
- private synchronized void checkConnectionStatus() {
+ @VisibleForTesting
Review Comment:
why ` @VisibleForTesting`?
--
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
[GitHub] [pulsar] mattisonchao commented on pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#issuecomment-1512433748
Hi @tiny-rain
This problem should be fixed by https://github.com/apache/pulsar/pull/18446
It changed to another thread, not zk internal 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
[GitHub] [pulsar] mattisonchao commented on a diff in pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#discussion_r1169475919
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java:
##########
@@ -81,7 +83,8 @@ public void close() throws Exception {
}
// task that runs every TICK_TIME to check zk connection
- private synchronized void checkConnectionStatus() {
+ @VisibleForTesting
+ private void checkConnectionStatus() {
Review Comment:
if zk client can't ensure the order. We should add a comment to explain this method is not thread-safe. because we call it in the single thread, it will be fine. but we shouldn't leave any potential problems in the future.
--
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
[GitHub] [pulsar] mattisonchao commented on pull request #20122: [fix][meta] deadlock of zkSessionWatcher when zkConnection loss
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on PR #20122:
URL: https://github.com/apache/pulsar/pull/20122#issuecomment-1513448049
@tiny-rain could you please help fix the CI?
--
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