Skip to content

HBASE-27093 AsyncNonMetaRegionLocator:put Complete CompletableFuture … - #4496

Merged
Apache9 merged 1 commit into
apache:masterfrom
xiaowangzhixiao:HBASE-27093
Jun 7, 2022
Merged

HBASE-27093 AsyncNonMetaRegionLocator:put Complete CompletableFuture …#4496
Apache9 merged 1 commit into
apache:masterfrom
xiaowangzhixiao:HBASE-27093

Conversation

@xiaowangzhixiao

Copy link
Copy Markdown
Contributor

…outside lock block

@Apache9

Copy link
Copy Markdown
Contributor

Mind provide some deadlock scenarios?

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec3m 32sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall3m 15smaster passed
+1 💚compile0m 17smaster passed
+1 💚shadedjars4m 21sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 17smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 3sthe patch passed
+1 💚compile0m 17sthe patch passed
+1 💚javac0m 17sthe patch passed
+1 💚shadedjars4m 21spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 15sthe patch passed
_ Other Tests _
+1 💚unit1m 22shbase-client in the patch passed.
22m 1s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#4496
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 57e2c59b0f87 5.4.0-1025-aws #25~18.04.1-Ubuntu SMP Fri Sep 11 12:03:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 93996bd
Default JavaAdoptOpenJDK-11.0.10+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/testReport/
Max. process+thread count195 (vs. ulimit of 30000)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec5m 58sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 56smaster passed
+1 💚compile0m 18smaster passed
+1 💚shadedjars4m 18sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 17smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 44sthe patch passed
+1 💚compile0m 19sthe patch passed
+1 💚javac0m 19sthe patch passed
+1 💚shadedjars4m 17spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 16sthe patch passed
_ Other Tests _
+1 💚unit1m 7shbase-client in the patch passed.
23m 32s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#4496
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 138e1f5d9cc9 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 93996bd
Default JavaAdoptOpenJDK-1.8.0_282-b08
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/testReport/
Max. process+thread count160 (vs. ulimit of 30000)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec6m 21sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+1 💚mvninstall3m 29smaster passed
+1 💚compile0m 42smaster passed
+1 💚checkstyle0m 17smaster passed
+1 💚spotless0m 47sbranch has no errors when running spotless:check.
+1 💚spotbugs0m 46smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 5sthe patch passed
+1 💚compile0m 44sthe patch passed
+1 💚javac0m 44sthe patch passed
+1 💚checkstyle0m 14sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck15m 7sPatch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚spotless0m 46spatch has no errors when running spotless:check.
+1 💚spotbugs0m 54sthe patch passed
_ Other Tests _
+1 💚asflicense0m 10sThe patch does not generate ASF License warnings.
39m 48s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#4496
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux 6173070fced5 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 93996bd
Default JavaAdoptOpenJDK-1.8.0_282-b08
Max. process+thread count70 (vs. ulimit of 30000)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4496/1/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@xiaowangzhixiao

xiaowangzhixiao commented Jun 7, 2022

Copy link
Copy Markdown
ContributorAuthor

Thank you for attention. @Apache9
For example, when request hbase in a outer lock, process response in this lock, and don't isolate the thread, it will cause deadlock. As the caller, we shouldn't care the lock in the hbase client.

CompletableFuture<Result> getResult(get) {
....
lock.lock();
future = asyncTable.get(get);
lock.unlock();
return future;
...
}
...
getResult(get).handle((v,e)->{
lock.lock();
...
lock.unlock();
});

In getResult(), the order of lock is lock.lock() -> tableCache.lock(). But when the regionLocation response have exception, future.completeExceptionally(err) will trigger this future's handle action, and the order of lock is tableCache.lock() -> lock.lock(). So it will cause deadlock.

Of course we can solve this problem by isolating threads, using handleAsync(xxxx, executor), but I think we can also avoid this in HBase client.

@Apache9

Copy link
Copy Markdown
Contributor

For example, when request hbase in a outer lock, process response in this lock, and don't isolate the thread, it will cause deadlock. As the caller, we shouldn't care the lock in the hbase client.

CompletableFuture<Result> getResult(get) {
....
lock.lock();
future = asyncTable.get(get);
lock.unlock();
return future;
...
}
...
getResult(get).handle((v,e)->{
lock.lock();
...
lock.unlock();
});

In getResult(), the order of lock is lock.lock() -> tableCache.lock(). But when the regionLocation response have exception, future.completeExceptionally(err) will trigger this future's handle action, and the order of lock is tableCache.lock() -> lock.lock(). So it will cause deadlock.

OK, typical usage, sound reasonable.

@Apache9
Apache9 merged commit 176c43c into apache:masterJun 7, 2022
Apache9 pushed a commit that referenced this pull request Jun 7, 2022
…outside lock block (#4496)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 176c43c)
Apache9 pushed a commit that referenced this pull request Jun 7, 2022
…outside lock block (#4496)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 176c43c)
Apache9 pushed a commit that referenced this pull request Jun 7, 2022
…outside lock block (#4496)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 176c43c)
wenwj0 pushed a commit to wenwj0/hbase that referenced this pull request Jun 14, 2022
…outside lock block (apache#4496)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
wenwj0 added a commit to wenwj0/hbase that referenced this pull request Jun 14, 2022
vinayakphegde pushed a commit to vinayakphegde/hbase that referenced this pull request Apr 4, 2024
…outside lock block (apache#4496)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 176c43c)
Change-Id: I4998fe348c86c6b0401f99bfe27bdaeb7ca21698
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@xiaowangzhixiao@Apache9@Apache-HBase