Skip to content

HBASE-27926 DBB release too early for replication - #5288

Closed
sunhelly wants to merge 1 commit into
apache:masterfrom
sunhelly:HBASE-27926
Closed

HBASE-27926 DBB release too early for replication#5288
sunhelly wants to merge 1 commit into
apache:masterfrom
sunhelly:HBASE-27926

Conversation

@sunhelly

Copy link
Copy Markdown
Contributor

No description provided.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 22sDocker 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 💚mvninstall2m 50smaster passed
+1 💚compile2m 26smaster passed
+1 💚checkstyle0m 36smaster passed
+1 💚spotless0m 43sbranch has no errors when running spotless:check.
+1 💚spotbugs1m 29smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 32sthe patch passed
+1 💚compile2m 23sthe patch passed
+1 💚javac2m 23sthe patch passed
+1 💚checkstyle0m 36sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck8m 59sPatch does not cause any errors with Hadoop 3.2.4 3.3.5.
+1 💚spotless0m 41spatch has no errors when running spotless:check.
+1 💚spotbugs1m 35sthe patch passed
_ Other Tests _
+1 💚asflicense0m 12sThe patch does not generate ASF License warnings.
31m 16s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#5288
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux 89cd1979033e 5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / ddc6752
Default JavaEclipse Adoptium-11.0.17+8
Max. process+thread count80 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/console
versionsgit=2.34.1 maven=3.8.6 spotbugs=4.7.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 🆗reexec0m 46sDocker 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 29smaster passed
+1 💚compile0m 40smaster passed
+1 💚shadedjars4m 30sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 26smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 14sthe patch passed
+1 💚compile0m 39sthe patch passed
+1 💚javac0m 39sthe patch passed
+1 💚shadedjars4m 29spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23sthe patch passed
_ Other Tests _
+1 💚unit222m 20shbase-server in the patch passed.
243m 36s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#5288
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 724d56eaf01b 5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / ddc6752
Default JavaTemurin-1.8.0_352-b08
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/testReport/
Max. process+thread count4057 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/console
versionsgit=2.34.1 maven=3.8.6
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 🆗reexec0m 50sDocker mode activated.
-0 ⚠️yetus0m 4sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 48smaster passed
+1 💚compile0m 46smaster passed
+1 💚shadedjars4m 38sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 27smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 34sthe patch passed
+1 💚compile0m 48sthe patch passed
+1 💚javac0m 48sthe patch passed
+1 💚shadedjars4m 32spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 25sthe patch passed
_ Other Tests _
-1 ❌unit222m 52shbase-server in the patch failed.
245m 27s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#5288
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 0e6898c0071f 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / ddc6752
Default JavaEclipse Adoptium-11.0.17+8
unithttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/artifact/yetus-jdk11-hadoop3-check/output/patch-unit-hbase-server.txt
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/testReport/
Max. process+thread count4426 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5288/1/console
versionsgit=2.34.1 maven=3.8.6
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache9

Copy link
Copy Markdown
Contributor

Mind explaining more? It is strange that why a general rpc resource releasing will only affect replication related calls?

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 45sDocker 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 💚mvninstall2m 49smaster passed
+1 💚compile2m 26smaster passed
+1 💚checkstyle0m 37smaster passed
+1 💚spotless0m 44sbranch has no errors when running spotless:check.
+1 💚spotbugs1m 33smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 32sthe patch passed
+1 💚compile2m 21sthe patch passed
+1 💚javac2m 21sthe patch passed
+1 💚checkstyle0m 33sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck8m 56sPatch does not cause any errors with Hadoop 3.2.4 3.3.5.
+1 💚spotless0m 41spatch has no errors when running spotless:check.
+1 💚spotbugs1m 36sthe patch passed
_ Other Tests _
+1 💚asflicense0m 12sThe patch does not generate ASF License warnings.
31m 48s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/hbase-kustomize-github-pr/job/PR-5288/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#5288
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux 7a44bd2dc58d 5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 68da890
Default JavaEclipse Adoptium-11.0.17+8
Max. process+thread count79 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/hbase-kustomize-github-pr/job/PR-5288/1/console
versionsgit=2.34.1 maven=3.8.6 spotbugs=4.7.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache9

Copy link
Copy Markdown
Contributor

Any updates here?

Thanks.

@bbeaudreaultbbeaudreault left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems like this will leak? What will run the cleanup?

Would be good to get a bit more details into your analysis/thinking here, both regarding the problem for replication and how this plays with other non-replication cases

@sunhelly

Copy link
Copy Markdown
ContributorAuthor

Thanks, @Apache9 , @bbeaudreault .
Under the current replication architecture, the replication requests are redirected by RSes. The dest cluster RSes act as hbase client to forward replicated edits to each other by calling ReplicationSink#batch. When using NettyRpcServer, the sink dest RS uses offheap byte buffer to keep the replicated edits and send RPCs to the RSes that the edits refer to, when encounters exception, the ServerCall run progress is not ended but the response.done() is called and the DBB will be released, then the next retries for the ReplicationSink#batch will use dirty DBB to replicate wrong edits.
I think ServerCall#cleanup called when the rpc call is completed or failed is enough. While another cleanup in NettyRpcServerResponseEncoder is redundant and will cause every RS client release the DBB before the ServerCall is really completed.

@bbeaudreault

Copy link
Copy Markdown
Contributor

I'd need to dig into the code to know for sure, but I think the appropriate thing to do might be to retain() in the replication endpoint rather than remove the release/done call in the encoder

@sunhelly

sunhelly commented Jul 5, 2023

Copy link
Copy Markdown
ContributorAuthor

I think the issue is not at the replication endpoint, e.g. source cluster RS A -> dest cluster RS B -> dest cluster RS C, when B act as client to send batches to C and fails, the DBB will be released before next retries. @bbeaudreault

@bbeaudreault

Copy link
Copy Markdown
Contributor

Yea so we are talking about RSRpcServices.replicateWALEntry endpoint, correct? The NettyRpcServerResponseEncoder calls done() after the response bytes are written to the channel (i.e. from ServerCall.sendResponseIfReady()). The response bytes in this case is an empty ReplicateWALEntryResponse proto. The replicateWALEntry method should only return a ReplicateWALEntryResponse once the batch calls have all succeeded or failed. So we should only trigger NettyRpcServerResponseEncoder once the batch calls have all succeeded or failed. So I'm not sure why this would cause a problem for retries within replicateWALEntry?

@sunhelly

sunhelly commented Jul 6, 2023

Copy link
Copy Markdown
ContributorAuthor

Using retain() before ReplicationSink.batch is reasonable. But I think there is another circumstance that the DBB will be released unexpectedly. That is, source cluster RS S1 -> dest cluster RS D1, dest cluster D1 redirects the entries to more than one other RSes, they can be D2,D3,D4..., but can also be D1 itself, I think this is the central problem.

@bbeaudreault

Copy link
Copy Markdown
Contributor

Is this repeatable for you? If so can you add logging to try to get a more exact trace of when the problem occurs? Otherwise add a unit test?

It’s really painful tracking down leaks, so I’m not excited to remove a release/cleanup without very clear evidence or other options ruled out.

@sunhelly

Copy link
Copy Markdown
ContributorAuthor

I will close this PR and try UT reproduce this issue in another. Any one intresting in this issue can try reproduce and fix it too. Thanks a lot.

@sunhellysunhelly closed this Jul 6, 2023
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.

4 participants

@sunhelly@Apache-HBase@Apache9@bbeaudreault