Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.19.1
-
None
Description
This issue happens because surefire kills the forked container if it times out waiting for the 'ping'.
In org.apache.maven.surefire.booter.ForkedBooter class there is hardcoded constant PING_TIMEOUT_IN_SECONDS = 20 which is used in the following method:
private static ScheduledFuture<?> listenToShutdownCommands( CommandReader reader ) { reader.addShutdownListener( createExitHandler( reader ) ); AtomicBoolean pingDone = new AtomicBoolean( true ); reader.addNoopListener( createPingHandler( pingDone ) ); return JVM_TERMINATOR.scheduleAtFixedRate( createPingJob( pingDone, reader ), 0,PING_TIMEOUT_IN_SECONDS, SECONDS ); }
to create ScheduledFuture.
In some of the cases the forked container might respond a bit later than it's expected and surefire kills it
private static Runnable createPingJob( final AtomicBoolean pingDone, final CommandReader reader ) { return new Runnable() { public void run() { boolean hasPing = pingDone.getAndSet( false ); if ( !hasPing ) { exit( 1, KILL, reader, true ); } } }; }
As long as we need to terminate it anyway, It would be really helpful if the problem could be solved making the PING_TIMEOUT_IN_SECONDS configurable with the ability to specify the value from maven-surefire-plugin.
It would help to configure this timeout based on needs and factors of the projects where surefire runs.
Attachments
Attachments
Issue Links
- duplicates
-
SUREFIRE-1261 surefire hangs of failed tests and keeps lock on surefirebooter on Windows preventing clean
- Closed
- is duplicated by
-
SUREFIRE-1370 Build failed in Jenkins with error :The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
- Closed
- relates to
-
SUREFIRE-1374 std/in stream corrupted error
- In Progress