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

Apache9 merged 1 commit into
apache:masterfrom
Apache9:HBASE-22316

Conversation

@Apache9

@Apache9 Apache9 commented May 29, 2019

Copy link
Copy Markdown
Contributor

No description provided.

@Apache9

Apache9 commented May 29, 2019

Copy link
Copy Markdown
Contributor Author

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
Contributor Author

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
Contributor Author

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
Contributor Author

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

Vote Subsystem Runtime Comment
0 reexec 38 Docker mode activated.
_ Prechecks _
+1 hbaseanti 0 Patch does not have any anti-patterns.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 mvninstall 284 master passed
+1 compile 24 master passed
+1 checkstyle 25 master passed
+1 shadedjars 302 branch has no errors when building our shaded downstream artifacts.
+1 findbugs 43 master passed
+1 javadoc 25 master passed
_ Patch Compile Tests _
+1 mvninstall 262 the patch passed
+1 compile 21 the patch passed
+1 javac 21 the patch passed
+1 checkstyle 24 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedjars 276 patch has no errors when building our shaded downstream artifacts.
+1 hadoopcheck 1108 Patch does not cause any errors with Hadoop 2.8.5 2.9.2 or 3.0.3 3.1.2.
+1 findbugs 50 the patch passed
+1 javadoc 19 the patch passed
_ Other Tests _
-1 unit 143 hbase-common in the patch failed.
+1 asflicense 11 The patch does not generate ASF License warnings.
7262
Reason Tests
Failed junit tests hadoop.hbase.util.TestFutureUtils
Subsystem Report/Notes
Docker Client=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 Tests dupname asflicense javac javadoc unit findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 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 tool maven
Personality /testptch/patchprocess/precommit/personality/provided.sh
git revision master / ca00cbe
maven version: Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Default Java 1.8.0_181
findbugs v3.1.11
unit https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/1/artifact/out/patch-unit-hbase-common.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/1/testReport/
Max. process+thread count 100 (vs. ulimit of 10000)
modules C: hbase-common U: hbase-common
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/1/console
Powered by Apache Yetus 0.9.0 http://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Comment
0 reexec 192 Docker mode activated.
_ Prechecks _
+1 hbaseanti 0 Patch does not have any anti-patterns.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 mvninstall 257 master passed
+1 compile 21 master passed
+1 checkstyle 25 master passed
+1 shadedjars 271 branch has no errors when building our shaded downstream artifacts.
+1 findbugs 39 master passed
+1 javadoc 21 master passed
_ Patch Compile Tests _
+1 mvninstall 253 the patch passed
+1 compile 20 the patch passed
+1 javac 20 the patch passed
+1 checkstyle 22 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedjars 268 patch has no errors when building our shaded downstream artifacts.
+1 hadoopcheck 1005 Patch does not cause any errors with Hadoop 2.8.5 2.9.2 or 3.0.3 3.1.2.
+1 findbugs 48 the patch passed
+1 javadoc 19 the patch passed
_ Other Tests _
+1 unit 166 hbase-common in the patch passed.
+1 asflicense 12 The patch does not generate ASF License warnings.
2952
Subsystem Report/Notes
Docker Client=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 Tests dupname asflicense javac javadoc unit findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 88c776ef7fbf 4.4.0-138-generic #164-Ubuntu SMP Tue Oct 2 17:16:02 UTC 2018 x86_64 GNU/Linux
Build tool maven
Personality /testptch/patchprocess/precommit/personality/provided.sh
git revision master / ca00cbe
maven version: Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Default Java 1.8.0_181
findbugs v3.1.11
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/2/testReport/
Max. process+thread count 363 (vs. ulimit of 10000)
modules C: hbase-common U: hbase-common
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-264/2/console
Powered by Apache Yetus 0.9.0 http://yetus.apache.org

This message was automatically generated.

@Apache9
Apache9 merged commit 1be93fc into apache:master May 30, 2019
Sign up for free to 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