Open
Description
Affected version
3.5.3
Bug description
Hi,
I have this simple JVM shutdown hook,
public class JVMShutdownHook {
static {
Thread hook = new Thread(() -> {
System.out.println("***********************Sysout from JVMShutdownHook***********************");
});
System.out.println("Register JVM Hook");
Runtime.getRuntime().addShutdownHook(hook);
}
}
It's registered in the @BeforeAll
method
public class JVMHookApplicationTests {
@BeforeAll
public static final void initiateJVMHook() throws ClassNotFoundException {
Class.forName("com.example.jvmHook.JVMShutdownHook");
}
@Test
public void simpleTest() {
assertEquals(6, 6);
}
}
The sysout
from the JVM hook doesn't work if the forkCount
is greater than 0. The JVM hook gets called consistently, but printing to the standard output doesn't always work (it works sometimes, but the behaviour is inconsistent).
The problem started from Suefire version 3.0.0-M5. It works fine with 3.0.0-M4 and prior versions.
Here is a simple application showing this problem - https://github.com/asif-anwar/jvm-hook