activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/3] activemq-artemis git commit: NO-JIRA More Strict settings for test thread leaks
Date Sat, 05 May 2018 02:47:10 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 950698960 -> 25f8820c5


NO-JIRA More Strict settings for test thread leaks

I'm investigating thread leakages and previous change on this class here is biting me.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/bc09a801
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/bc09a801
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/bc09a801

Branch: refs/heads/master
Commit: bc09a8011d245cc853ffc32916aa4e6a922cc162
Parents: 61d2cc5
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Thu May 3 21:36:40 2018 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri May 4 22:43:56 2018 -0400

----------------------------------------------------------------------
 .../activemq/artemis/utils/ThreadLeakCheckRule.java       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bc09a801/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
index 1401180..d9dafac 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
@@ -44,6 +44,10 @@ public class ThreadLeakCheckRule extends TestWatcher {
 
    protected boolean testFailed = false;
 
+   protected Description testDescription = null;
+
+   protected Throwable failure = null;
+
    protected Map<Thread, StackTraceElement[]> previousThreads;
 
    /**
@@ -65,7 +69,9 @@ public class ThreadLeakCheckRule extends TestWatcher {
 
    @Override
    protected void failed(Throwable e, Description description) {
+      this.failure = e;
       this.testFailed = true;
+      this.testDescription = description;
    }
 
    @Override
@@ -86,7 +92,7 @@ public class ThreadLeakCheckRule extends TestWatcher {
             boolean failedOnce = false;
 
             // if the test failed.. there's no point on waiting a full minute.. we will report
it once and go
-            long timeout = System.currentTimeMillis() + (testFailed ? 1000 : 60000);
+            long timeout = System.currentTimeMillis() + (testFailed ? 30000 : 60000);
             while (failed && timeout > System.currentTimeMillis()) {
                failed = checkThread();
 
@@ -108,6 +114,8 @@ public class ThreadLeakCheckRule extends TestWatcher {
                   System.out.println("***********************************************************************");
                   System.out.println("             The test failed and there is a leak");
                   System.out.println("***********************************************************************");
+                  failure.printStackTrace();
+                  Assert.fail("Test " + testDescription + " Failed with a leak - " + failure.getMessage());
                }
             } else if (failedOnce) {
                System.out.println("******************** Threads cleared after retries ********************");


Mime
View raw message