maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuriy Zaplavnov (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SUREFIRE-1302) Surefire does not wait long enough for the forked VM and assumes it to be dead
Date Mon, 14 Nov 2016 15:09:58 GMT

    [ https://issues.apache.org/jira/browse/SUREFIRE-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15664126#comment-15664126
] 

Yuriy Zaplavnov edited comment on SUREFIRE-1302 at 11/14/16 3:09 PM:
---------------------------------------------------------------------

[~tibor17]
Attached the custom logs captured from surefire booter (recompiled the 2.19.1 version with
logging, two tests launched in forked VM).

If you compare the timestamp records from this 2nd log with the records from 1st log, you
will find that process is still alive, running and logging the execution within the time interval
when the pingDone variable hasn't been updated.

In some cases randomly tests complete successfully in some cases not.

As far as you can see there are no errors related to corrupted stream.

Hopefully this information would help you somehow.


was (Author: xeagle):
Attached the custom logs captured from surefire booter (recompiled the 2.19.1 version with
logging, two tests launched in forked VM).

If you compare the timestamp records from this 2nd log with the records from 1st log, you
will find that process is still alive, running and logging the execution within the time interval
when the pingDone variable hasn't been updated.

In some cases randomly tests complete successfully in some cases not.

As far as you can see there are no errors related to corrupted stream.

Hopefully this information would help you somehow.

> Surefire does not wait long enough for the forked VM and assumes it to be dead
> ------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1302
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1302
>             Project: Maven Surefire
>          Issue Type: Request
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.19.1
>            Reporter: Yuriy Zaplavnov
>         Attachments: tests_log_01.txt, tests_log_02.txt
>
>
> 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:
> {code}
> 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
);
>     }
> {code}
> to create ScheduledFuture.
> In some of the cases the forked container might respond a bit later than it's expected
and surefire kills it
> {code}
> 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 );
>                 }
>             }
>         };
>     }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message