Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-27857 Fix timeout exception handling in HBaseClassTestRule #5231

Merged

Conversation

jonathan-albrecht-ibm
Copy link
Contributor

HBaseClassTestRule applies a timeout and a system exit rule to tests. The timeout rule throws an exception if it hits the timeout threshold. Since the timeout rule is applied after the system exit rule, the system exit rule does not see the exception and does not re-enable the system exit behavior which can cause maven to hang on some tests.

This change applies the timeout rule before the system exit rule so that normal system exit can be restored before the surefire forked node is shutdown.

HBaseClassTestRule applies a timeout and a system exit rule to tests.
The timeout rule throws an exception if it hits the timeout threshold.
Since the timeout rule is applied after the system exit rule, the
system exit rule does not see the exception and does not re-enable
the system exit behavior which can cause maven to hang on some
tests.

This change applies the timeout rule before the system exit rule so
that normal system exit can be restored before the surefire forked
node is shutdown.

Signed-off-by: Jonathan Albrecht <jonathan.albrecht@ibm.com>
@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 22s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
-1 ❌ mvninstall 0m 17s root in master failed.
-1 ❌ compile 0m 11s hbase-common in master failed.
-1 ❌ shadedjars 0m 12s branch has 7 errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 7s hbase-common in master failed.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 7s the patch passed
+1 💚 compile 0m 16s the patch passed
+1 💚 javac 0m 16s the patch passed
+1 💚 shadedjars 4m 49s patch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 15s hbase-common generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
_ Other Tests _
+1 💚 unit 1m 49s hbase-common in the patch passed.
12m 41s
Subsystem Report/Notes
Docker ClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #5231
Optional Tests javac javadoc unit shadedjars compile
uname Linux 1e83cb88cae7 5.4.0-1099-aws #107~18.04.1-Ubuntu SMP Fri Mar 17 16:49:05 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 5cea811
Default Java Temurin-1.8.0_352-b08
mvninstall https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-jdk8-hadoop3-check/output/branch-mvninstall-root.txt
compile https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-jdk8-hadoop3-check/output/branch-compile-hbase-common.txt
shadedjars https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-jdk8-hadoop3-check/output/branch-shadedjars.txt
javadoc https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-jdk8-hadoop3-check/output/branch-javadoc-hbase-common.txt
javadoc https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-jdk8-hadoop3-check/output/diff-javadoc-javadoc-hbase-common.txt
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/testReport/
Max. process+thread count 162 (vs. ulimit of 30000)
modules C: hbase-common U: hbase-common
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/console
versions git=2.34.1 maven=3.8.6
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 23s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 3m 35s master passed
+1 💚 compile 0m 15s master passed
+1 💚 shadedjars 4m 37s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 15s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 17s the patch passed
+1 💚 compile 0m 15s the patch passed
+1 💚 javac 0m 15s the patch passed
+1 💚 shadedjars 4m 34s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 12s the patch passed
_ Other Tests _
+1 💚 unit 2m 24s hbase-common in the patch passed.
21m 7s
Subsystem Report/Notes
Docker ClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #5231
Optional Tests javac javadoc unit shadedjars compile
uname Linux a1b4edb118ac 5.4.0-1097-aws #105~18.04.1-Ubuntu SMP Mon Feb 13 17:50:57 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 5cea811
Default Java Eclipse Adoptium-11.0.17+8
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/testReport/
Max. process+thread count 192 (vs. ulimit of 30000)
modules C: hbase-common U: hbase-common
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/console
versions git=2.34.1 maven=3.8.6
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 32s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 5m 16s master passed
+1 💚 compile 0m 50s master passed
+1 💚 checkstyle 0m 23s master passed
+1 💚 spotless 1m 6s branch has no errors when running spotless:check.
+1 💚 spotbugs 0m 46s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 5m 9s the patch passed
+1 💚 compile 0m 45s the patch passed
+1 💚 javac 0m 45s the patch passed
+1 💚 checkstyle 0m 20s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 18m 1s Patch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚 spotless 0m 58s patch has no errors when running spotless:check.
+1 💚 spotbugs 0m 53s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
47m 12s
Subsystem Report/Notes
Docker ClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #5231
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
uname Linux 7f65005089fd 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 5cea811
Default Java Eclipse Adoptium-11.0.17+8
Max. process+thread count 85 (vs. ulimit of 30000)
modules C: hbase-common U: hbase-common
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/1/console
versions git=2.34.1 maven=3.8.6 spotbugs=4.7.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache9
Copy link
Contributor

Apache9 commented May 11, 2023

Mind explain a bit more? IIRC, the SystemExitRule is to forbid System.exit call, so what is actual problem here?

@jonathan-albrecht-ibm
Copy link
Contributor Author

Mind explain a bit more? IIRC, the SystemExitRule is to forbid System.exit call, so what is actual problem here?

Yes, the SystemExitRule is supposed to forbid the System.exit call while a test is running so that the various test servers running in the surefire forked jvm don't cause it to exit before a test has finished IIUC. The SystemExitRule will restore the normal System.exit behaviour when the test completes. The problem is, if a test times out, the test doesn't actually complete. The forked jvm really does need to exit but the SystemExitRule hasn't restored System.exit so it can't.

Note that the timeout exception originates in the timeout rule part of HBaseClassTestRule. The timeout rule actually runs the test method in a separate thread in a Future with a timeout value.

The change in this PR applies the systemExitRule first so when the timeout rule throws an exception it will go through the try...finally block in the systemExitRule which restores the normal System.exit and the forked jvm can exit normally when it needs to.

Without this change, you can see that org.apache.hadoop.hbase.TestSecurityManager shows up in the stacktrace if a test times out:

Created at 2023-04-27T15:51:58.947
org.apache.hadoop.hbase.SystemExitRule$SystemExitInTestException
        at org.apache.hadoop.hbase.TestSecurityManager.checkExit(TestSecurityManager.java:32)
        at java.base/java.lang.Runtime.exit(Runtime.java:114)
        at java.base/java.lang.System.exit(System.java:1752)
        at org.apache.maven.surefire.booter.ForkedBooter.acknowledgedExit(ForkedBooter.java:381)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:178)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 22s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 2m 48s master passed
+1 💚 compile 0m 14s master passed
+1 💚 shadedjars 4m 38s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 12s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 48s the patch passed
+1 💚 compile 0m 14s the patch passed
+1 💚 javac 0m 14s the patch passed
+1 💚 shadedjars 4m 39s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 11s the patch passed
_ Other Tests _
+1 💚 unit 1m 41s hbase-common in the patch passed.
18m 48s
Subsystem Report/Notes
Docker ClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #5231
Optional Tests javac javadoc unit shadedjars compile
uname Linux dbfeed27a172 5.4.0-1099-aws #107~18.04.1-Ubuntu SMP Fri Mar 17 16:49:05 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / e343584
Default Java Temurin-1.8.0_352-b08
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/testReport/
Max. process+thread count 163 (vs. ulimit of 30000)
modules C: hbase-common U: hbase-common
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/console
versions git=2.34.1 maven=3.8.6
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 26s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 3m 39s master passed
+1 💚 compile 0m 14s master passed
+1 💚 shadedjars 4m 47s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 15s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 22s the patch passed
+1 💚 compile 0m 15s the patch passed
+1 💚 javac 0m 15s the patch passed
+1 💚 shadedjars 4m 47s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 13s the patch passed
_ Other Tests _
+1 💚 unit 2m 27s hbase-common in the patch passed.
21m 29s
Subsystem Report/Notes
Docker ClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #5231
Optional Tests javac javadoc unit shadedjars compile
uname Linux 10589cff1b86 5.4.0-1097-aws #105~18.04.1-Ubuntu SMP Mon Feb 13 17:50:57 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / e343584
Default Java Eclipse Adoptium-11.0.17+8
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/testReport/
Max. process+thread count 199 (vs. ulimit of 30000)
modules C: hbase-common U: hbase-common
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/console
versions git=2.34.1 maven=3.8.6
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 50s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 3m 16s master passed
+1 💚 compile 0m 32s master passed
+1 💚 checkstyle 0m 15s master passed
+1 💚 spotless 0m 41s branch has no errors when running spotless:check.
+1 💚 spotbugs 0m 32s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 12s the patch passed
+1 💚 compile 0m 32s the patch passed
+1 💚 javac 0m 32s the patch passed
+1 💚 checkstyle 0m 14s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 12m 1s Patch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚 spotless 0m 41s patch has no errors when running spotless:check.
+1 💚 spotbugs 0m 37s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 9s The patch does not generate ASF License warnings.
30m 28s
Subsystem Report/Notes
Docker ClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #5231
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
uname Linux cdc6d774ffa7 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / e343584
Default Java Eclipse Adoptium-11.0.17+8
Max. process+thread count 80 (vs. ulimit of 30000)
modules C: hbase-common U: hbase-common
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5231/2/console
versions git=2.34.1 maven=3.8.6 spotbugs=4.7.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache9 Apache9 merged commit 220eacf into apache:master May 13, 2023
Apache9 pushed a commit that referenced this pull request May 13, 2023
)

HBaseClassTestRule applies a timeout and a system exit rule to tests.
The timeout rule throws an exception if it hits the timeout threshold.
Since the timeout rule is applied after the system exit rule, the
system exit rule does not see the exception and does not re-enable
the system exit behavior which can cause maven to hang on some
tests.

This change applies the timeout rule before the system exit rule so
that normal system exit can be restored before the surefire forked
node is shutdown.

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 220eacf)
Apache9 pushed a commit that referenced this pull request May 13, 2023
)

HBaseClassTestRule applies a timeout and a system exit rule to tests.
The timeout rule throws an exception if it hits the timeout threshold.
Since the timeout rule is applied after the system exit rule, the
system exit rule does not see the exception and does not re-enable
the system exit behavior which can cause maven to hang on some
tests.

This change applies the timeout rule before the system exit rule so
that normal system exit can be restored before the surefire forked
node is shutdown.

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 220eacf)
Apache9 pushed a commit that referenced this pull request May 13, 2023
)

HBaseClassTestRule applies a timeout and a system exit rule to tests.
The timeout rule throws an exception if it hits the timeout threshold.
Since the timeout rule is applied after the system exit rule, the
system exit rule does not see the exception and does not re-enable
the system exit behavior which can cause maven to hang on some
tests.

This change applies the timeout rule before the system exit rule so
that normal system exit can be restored before the surefire forked
node is shutdown.

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 220eacf)
@jonathan-albrecht-ibm
Copy link
Contributor Author

Thanks for reviewing and merging @Apache9!

vinayakphegde pushed a commit to vinayakphegde/hbase that referenced this pull request Apr 4, 2024
…ache#5231)

HBaseClassTestRule applies a timeout and a system exit rule to tests.
The timeout rule throws an exception if it hits the timeout threshold.
Since the timeout rule is applied after the system exit rule, the
system exit rule does not see the exception and does not re-enable
the system exit behavior which can cause maven to hang on some
tests.

This change applies the timeout rule before the system exit rule so
that normal system exit can be restored before the surefire forked
node is shutdown.

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 220eacf)
(cherry picked from commit 4df157d)
Change-Id: Id051ff2cf38fcdd3ef47f7e8d9ec99a8de88b6c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants