Skip to content

HBASE-22316 Record the stack trace for current thread in FutureUtils.get - #264

Merged
Apache9 merged 1 commit into
apache:masterfrom
Apache9:HBASE-22316
May 30, 2019
Merged

HBASE-22316 Record the stack trace for current thread in FutureUtils.get#264
Apache9 merged 1 commit into
apache:masterfrom
Apache9:HBASE-22316

Conversation

@Apache9

Copy link
Copy Markdown
Contributor

No description provided.

@Apache9

Copy link
Copy Markdown
ContributorAuthor

The stack trace in the newly introduced UT is

org.apache.hadoop.hbase.HBaseIOException: Inject error!
at java.lang.Thread.getStackTrace(Thread.java:1559)
at org.apache.hadoop.hbase.util.FutureUtils.setStackTrace(FutureUtils.java:130)
at org.apache.hadoop.hbase.util.FutureUtils.rethrow(FutureUtils.java:145)
at org.apache.hadoop.hbase.util.FutureUtils.get(FutureUtils.java:168)
at org.apache.hadoop.hbase.util.TestFutureUtils.testRecordStackTrace(TestFutureUtils.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
at --------Future.get--------(Unknown Source)
at org.apache.hadoop.hbase.util.TestFutureUtils.lambda$0(TestFutureUtils.java:62)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

} else if (cause instanceof Error) {
setStackTrace(cause);
throw (Error) cause;
} else {

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.

Why don't setStackTrace here?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

We just create a new IOException, it will record the stack trace when creating the new IOException. When you call printStackTrace, you will see a 'Caused by:'

error.setStackTrace(newStackTrace);
}

private static IOException rethrow(ExecutionException error) throws IOException {

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.

The return parameter can be void?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This is for the caller, we can just use throw rethrow(e), otherwise you need to manually write an unused throw new IOException() at the end.

Throwable cause = e.getCause();
Throwables.propagateIfPossible(cause, IOException.class);
throw new IOException(cause);
throw rethrow(e);

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.

rethrow(e)?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

There will be a compile error if you do not have a return or throw statement in this block...

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
0reexec38Docker mode activated.
_ Prechecks _
+1hbaseanti0Patch does not have any anti-patterns.
+1@author0The patch does not contain any @author tags.
+1test4tests0The patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1mvninstall284master passed
+1compile24master passed
+1checkstyle25master passed
+1shadedjars302branch has no errors when building our shaded downstream artifacts.
+1findbugs43master passed
+1javadoc25master passed
_ Patch Compile Tests _
+1mvninstall262the patch passed
+1compile21the patch passed
+1javac21the patch passed
+1checkstyle24the patch passed
+1whitespace0The patch has no whitespace issues.
+1shadedjars276patch has no errors when building our shaded downstream artifacts.
+1hadoopcheck1108Patch does not cause any errors with Hadoop 2.8.5 2.9.2 or 3.0.3 3.1.2.
+1findbugs50the patch passed
+1javadoc19the patch passed
_ Other Tests _
-1unit143hbase-common in the patch failed.
+1asflicense11The patch does not generate ASF License warnings.
7262
ReasonTests
Failed junit testshadoop.hbase.util.TestFutureUtils
SubsystemReport/Notes
DockerClient=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/1/artifact/out/Dockerfile
GITHUB PR#264
Optional Testsdupname asflicense javac javadoc unit findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
unameLinux b06a59bb1582 4.4.0-144-generic #170~14.04.1-Ubuntu SMP Mon Mar 18 15:02:05 UTC 2019 x86_64 GNU/Linux
Build toolmaven
Personality/testptch/patchprocess/precommit/personality/provided.sh
git revisionmaster / ca00cbe
mavenversion: Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Default Java1.8.0_181
findbugsv3.1.11
unithttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/1/artifact/out/patch-unit-hbase-common.txt
Test Resultshttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/1/testReport/
Max. process+thread count100 (vs. ulimit of 10000)
modulesC: hbase-common U: hbase-common
Console outputhttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/1/console
Powered byApache Yetus 0.9.0 http://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
0reexec192Docker mode activated.
_ Prechecks _
+1hbaseanti0Patch does not have any anti-patterns.
+1@author0The patch does not contain any @author tags.
+1test4tests0The patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1mvninstall257master passed
+1compile21master passed
+1checkstyle25master passed
+1shadedjars271branch has no errors when building our shaded downstream artifacts.
+1findbugs39master passed
+1javadoc21master passed
_ Patch Compile Tests _
+1mvninstall253the patch passed
+1compile20the patch passed
+1javac20the patch passed
+1checkstyle22the patch passed
+1whitespace0The patch has no whitespace issues.
+1shadedjars268patch has no errors when building our shaded downstream artifacts.
+1hadoopcheck1005Patch does not cause any errors with Hadoop 2.8.5 2.9.2 or 3.0.3 3.1.2.
+1findbugs48the patch passed
+1javadoc19the patch passed
_ Other Tests _
+1unit166hbase-common in the patch passed.
+1asflicense12The patch does not generate ASF License warnings.
2952
SubsystemReport/Notes
DockerClient=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/2/artifact/out/Dockerfile
GITHUB PR#264
Optional Testsdupname asflicense javac javadoc unit findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
unameLinux 88c776ef7fbf 4.4.0-138-generic #164-Ubuntu SMP Tue Oct 2 17:16:02 UTC 2018 x86_64 GNU/Linux
Build toolmaven
Personality/testptch/patchprocess/precommit/personality/provided.sh
git revisionmaster / ca00cbe
mavenversion: Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Default Java1.8.0_181
findbugsv3.1.11
Test Resultshttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/2/testReport/
Max. process+thread count363 (vs. ulimit of 10000)
modulesC: hbase-common U: hbase-common
Console outputhttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/2/console
Powered byApache Yetus 0.9.0 http://yetus.apache.org

This message was automatically generated.

@Apache9
Apache9 merged commit 1be93fc into apache:masterMay 30, 2019
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

@Apache9@Apache-HBase@infraio