You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Kamalpreet (Jira)" <ji...@apache.org> on 2022/08/24 13:03:00 UTC

[jira] [Updated] (SUREFIRE-2114) Surefire is going to kill self fork JVM. The exit has elapsed 30 seconds after System.exit(0).

     [ https://issues.apache.org/jira/browse/SUREFIRE-2114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kamalpreet updated SUREFIRE-2114:
---------------------------------
    Description: 
Hi Team, 

I'm using maven surefire plugin to execute tests on two testing frameworks (e.g, jUnit, jBehave).

Have tried to implement parallelisation by spawning couple of Threads which in turn create processes to execute surefire jar (taking it from 

 
{code:java}
ManagementFactory.getRuntimeMXBean().getSystemProperties().get("sun.java.command"){code}
Code snippet to show process creation - 
{code:java}
ProcessBuilder processBuilder = new ProcessBuilder(commandArray);
Map<String, String> environment = processBuilder.environment();
environment.put("platformIndex", String.valueOf(platformIndex));
try {
    processBuilder.inheritIO();
    Process p = processBuilder.start();
    LOGGER.info("Is Alive {} {}", p.isAlive(), LocalTime.now());
    int statusCode = p.waitFor();
} catch (Exception e) {
    e.printStackTrace();
} {code}
And then calling *System.exit.*

 

*After running two or sometimes three processes in corresponding Threads, the process execution got stuck on p.waitFor();*

Then the process exits after 30 secs and with error message *"Surefire is going to kill self fork JVM. The exit has elapsed 30 seconds after System.exit(0)."* resulting in Build Failure though the tests have passed in their respective processes.

Seems like surefire execution is stuck in some processes. Could you please let me know what can be the possible reasons for it and how to mitigate this? Tried extending the ForkedProcessTimeoutInSeconds to few minutes.

 

Thanks.

  was:
Hi Team, 

I'm using maven surefire plugin to execute tests on two testing frameworks (e.g, jUnit, jBehave).

Have tried to implement parallelisation by spawning couple of Threads which in turn create processes to execute surefire jar (taking it from 

 
{code:java}
ManagementFactory.getRuntimeMXBean().getSystemProperties().get("sun.java.command"){code}
Code snippet to show process creation - 
{code:java}
ProcessBuilder processBuilder = new ProcessBuilder(commandArray);
Map<String, String> environment = processBuilder.environment();
environment.put("platformIndex", String.valueOf(platformIndex));
try {
    processBuilder.inheritIO();
    Process p = processBuilder.start();
    LOGGER.info("Is Alive {} {}", p.isAlive(), LocalTime.now());
    int statusCode = p.waitFor();
} catch (Exception e) {
    e.printStackTrace();
} {code}
And then calling *System.exit.*

 

*After running two or sometimes three processes in corresponding Threads, the process execution got stuck on p.waitFor();*

Then the process exits after 30 secs and with error message *"Surefire is going to kill self fork JVM. The exit has elapsed 30 seconds after System.exit(0)."* resulting in Build Failure though the tests have passed in their respective processes.

Seems like surefire execution is stuck in some processes. Could you please let me know what can be the possible reasons for it and how to mitigate this? Tried extending the ForkedProcessTimeoutInSeconds to few minutes.

 

Thanks.

 


>  Surefire is going to kill self fork JVM. The exit has elapsed 30 seconds after System.exit(0).
> -----------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-2114
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2114
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>            Reporter: Kamalpreet
>            Priority: Critical
>
> Hi Team, 
> I'm using maven surefire plugin to execute tests on two testing frameworks (e.g, jUnit, jBehave).
> Have tried to implement parallelisation by spawning couple of Threads which in turn create processes to execute surefire jar (taking it from 
>  
> {code:java}
> ManagementFactory.getRuntimeMXBean().getSystemProperties().get("sun.java.command"){code}
> Code snippet to show process creation - 
> {code:java}
> ProcessBuilder processBuilder = new ProcessBuilder(commandArray);
> Map<String, String> environment = processBuilder.environment();
> environment.put("platformIndex", String.valueOf(platformIndex));
> try {
>     processBuilder.inheritIO();
>     Process p = processBuilder.start();
>     LOGGER.info("Is Alive {} {}", p.isAlive(), LocalTime.now());
>     int statusCode = p.waitFor();
> } catch (Exception e) {
>     e.printStackTrace();
> } {code}
> And then calling *System.exit.*
>  
> *After running two or sometimes three processes in corresponding Threads, the process execution got stuck on p.waitFor();*
> Then the process exits after 30 secs and with error message *"Surefire is going to kill self fork JVM. The exit has elapsed 30 seconds after System.exit(0)."* resulting in Build Failure though the tests have passed in their respective processes.
> Seems like surefire execution is stuck in some processes. Could you please let me know what can be the possible reasons for it and how to mitigate this? Tried extending the ForkedProcessTimeoutInSeconds to few minutes.
>  
> Thanks.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)