This is an automated email from the ASF dual-hosted git repository. tibordigana pushed a commit to branch buildfix in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/buildfix by this push: new 3a3e205 investigating build failure 3a3e205 is described below commit 3a3e205fd9f25a66ea8113ae299f72d3d5c62128 Author: tibordigana <tibordig...@apache.org> AuthorDate: Fri Jul 19 12:11:06 2019 +0200 investigating build failure --- .../apache/maven/surefire/booter/ForkedBooter.java | 64 ++++++++++++++-------- ...Surefire946KillMainProcessInReusableForkIT.java | 4 +- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java index 48a066b..507fb59 100644 --- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java +++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java @@ -209,7 +209,11 @@ public final class ForkedBooter && !pingMechanism.pingScheduler.isShutdown() ) { DumpErrorSingleton.getSingleton() - .dumpText( "Killing self fork JVM. Maven process died." ); + .dumpText( "Killing self fork JVM. Maven process died." + + NL + + "Thread dump before killing the process (" + getProcessName() + "):" + + NL + + generateThreadDump() ); kill(); } @@ -248,7 +252,7 @@ public final class ForkedBooter DumpErrorSingleton.getSingleton() .dumpText( "Killing self fork JVM. Received SHUTDOWN command from Maven shutdown hook." + NL - + "Thread dump:" + + "Thread dump before killing the process (" + getProcessName() + "):" + NL + generateThreadDump() ); kill(); @@ -259,7 +263,7 @@ public final class ForkedBooter DumpErrorSingleton.getSingleton() .dumpText( "Exiting self fork JVM. Received SHUTDOWN command from Maven shutdown hook." + NL - + "Thread dump:" + + "Thread dump before exiting the process (" + getProcessName() + "):" + NL + generateThreadDump() ); exitBarrier.release(); @@ -269,7 +273,11 @@ public final class ForkedBooter { // else refers to shutdown=testset, but not used now, keeping reader open DumpErrorSingleton.getSingleton() - .dumpText( "Thread dump:" + NL + generateThreadDump() ); + .dumpText( "Thread dump for process (" + + getProcessName() + + "):" + + NL + + generateThreadDump() ); } } }; @@ -288,7 +296,11 @@ public final class ForkedBooter if ( !hasPing ) { DumpErrorSingleton.getSingleton() - .dumpText( "Killing self fork JVM. PING timeout elapsed." ); + .dumpText( "Killing self fork JVM. PING timeout elapsed." + + NL + + "Thread dump before killing the process (" + getProcessName() + "):" + + NL + + generateThreadDump() ); kill(); } @@ -362,25 +374,25 @@ public final class ForkedBooter @SuppressWarnings( "checkstyle:emptyblock" ) private void launchLastDitchDaemonShutdownThread( final int returnCode ) { - getJvmTerminator().schedule( new Runnable() - { - @Override - public void run() - { - kill( returnCode ); - } - }, systemExitTimeoutInSeconds, SECONDS + getJvmTerminator() + .schedule( new Runnable() + { + @Override + public void run() + { + DumpErrorSingleton.getSingleton() + .dumpText( "Thread dump for process (" + + getProcessName() + + ") after " + + systemExitTimeoutInSeconds + + " seconds shutdown timeout:" + + NL + + generateThreadDump() ); + + kill( returnCode ); + } + }, systemExitTimeoutInSeconds, SECONDS ); - - /*createPingScheduler().scheduleAtFixedRate( new Runnable() - { - @Override - public void run() - { - DumpErrorSingleton.getSingleton().dumpText( new Date() + " I am in PING." ); - kill( returnCode ); - } - }, 0L, PING_TIMEOUT_IN_SECONDS, SECONDS );*/ } private void invokeProviderInSameClassLoader( ForkingReporterFactory factory ) @@ -527,4 +539,10 @@ public final class ForkedBooter } return dump.toString(); } + + private static String getProcessName() + { + return ManagementFactory.getRuntimeMXBean() + .getName(); + } } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java index be2a81e..83527a6 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java @@ -33,7 +33,8 @@ public class Surefire946KillMainProcessInReusableForkIT @BeforeClass public static void installSelfdestructPlugin() { - unpack( Surefire946KillMainProcessInReusableForkIT.class, "surefire-946-self-destruct-plugin", "plugin" ).executeInstall(); + unpack( Surefire946KillMainProcessInReusableForkIT.class, "surefire-946-self-destruct-plugin", "plugin" ) + .executeInstall(); } @Test( timeout = 30000 ) @@ -59,6 +60,7 @@ public class Surefire946KillMainProcessInReusableForkIT private void doTest( String method ) { unpack( "surefire-946-killMainProcessInReusableFork" ) + .sysProp( "surefire.shutdown", "exit" ) .sysProp( "selfdestruct.timeoutInMillis", "5000" ) .sysProp( "selfdestruct.method", method ) .sysProp( "testSleepTime", String.valueOf( TEST_SLEEP_TIME ) )