You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/10/09 09:13:38 UTC

[maven-surefire] branch gh-build-fix updated: [GH] investigate

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch gh-build-fix
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/gh-build-fix by this push:
     new 91f6370  [GH] investigate
91f6370 is described below

commit 91f63704230a334f81043adddb13b07ce9b4a774
Author: tibordigana <ti...@apache.org>
AuthorDate: Fri Oct 9 11:13:30 2020 +0200

    [GH] investigate
---
 .../surefire/extensions/EventConsumerThread.java   |  1 +
 .../org/apache/maven/surefire/JUnit4SuiteTest.java | 31 ++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java
index 8b855d8..4f1ea09 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java
@@ -262,6 +262,7 @@ public class EventConsumerThread extends CloseableDaemonThread
             }
             catch ( RuntimeException e )
             {
+                e.printStackTrace();
                 arguments.dumpStreamException( e );
             }
             catch ( IOException e )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
index 7692a04..4037772 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
@@ -64,6 +64,12 @@ import org.apache.maven.surefire.report.RunStatisticsTest;
 import org.apache.maven.surefire.spi.SPITest;
 import org.apache.maven.surefire.util.RelocatorTest;
 
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+
 /**
  * Adapt the JUnit4 tests which use only annotations to the JUnit3 test suite.
  *
@@ -74,6 +80,7 @@ public class JUnit4SuiteTest extends TestCase
 {
     public static Test suite()
     {
+        threadDump();
         TestSuite suite = new TestSuite();
         suite.addTestSuite( RelocatorTest.class );
         suite.addTestSuite( RunStatisticsTest.class );
@@ -118,4 +125,28 @@ public class JUnit4SuiteTest extends TestCase
         suite.addTest( new JUnit4TestAdapter( EventConsumerThreadTest.class ) );
         return suite;
     }
+
+    @SuppressWarnings( "checkstyle:magicnumber" )
+    private static void threadDump()
+    {
+        Thread t = new Thread( new FutureTask<>( new Callable<Void>()
+        {
+            @Override
+            public Void call() throws Exception
+            {
+                Thread.sleep( 30_000L );
+                StringBuilder threadDump = new StringBuilder( "### THIS IS THREAD DUMP BEG ###" );
+                ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+                for( ThreadInfo threadInfo : threadMXBean.dumpAllThreads( true, true ) )
+                {
+                    threadDump.append( System.lineSeparator() ).append( threadInfo.toString() );
+                }
+                threadDump.append( System.lineSeparator() ).append( "### THIS IS THREAD DUMP END ###" );
+                System.out.println( threadDump );
+                return null;
+            }
+        } ) );
+        t.setDaemon( true );
+        t.start();
+    }
 }