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

Jan Blizňák commented on SUREFIRE-1479:
---------------------------------------

Same issue persists in latest 2.21.0 and it is related to SUREFIRE-1422 and 
SUREFIRE-1444.
 The problem is (from doc):
{noformat}
On Unix like systems the process' uptime is determined by native command 
(/usr)/bin/ps -o etime= -p [PID] .{noformat}
[https://github.com/apache/maven-surefire/blob/master/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java#L160]

 
{code:java}
user@hpux:/tmp>uname -rsm
HP-UX B.11.31 ia64
user@hpux:/tmp>/bin/ps -o etime= -p 123    
/bin/ps: illegal option -- o
usage: /bin/ps [-edaxzflP] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R 
prmgroup] [-Z psetidlist]
user@hpux:/tmp>/usr/bin/ps -o etime= -p 123
/usr/bin/ps: illegal option -- o
usage: /usr/bin/ps [-edaxzflP] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R 
prmgroup] [-Z psetidlist]
{code}
 

Man pages for HP-UX 11:
 [http://www.polarhome.com/service/man/?qf=ps&tf=2&of=HP-UX&sf=1]
 [http://www.polarhome.com/service/man/?qf=standards&tf=2&of=HP-UX&sf=5]

 

 Given that, the easiest fix is to pass {{UNIX95=1}} environment property to 
the {{ps}} or {{sh}} call
{code:java}
user@hpux:/tmp>UNIX95=1 /usr/bin/ps -o etime= -p 28970
03:01:08
user@hpux:/tmp>UNIX95=1 /bin/ps -o etime= -p 28970
03:01:11
user@hpux:/tmp>UNIX95=1 /bin/sh -c "/usr/bin/ps -o etime= -p 28970"
03:01:35
user@hpux:/tmp>UNIX95=1 /usr/bin/sh -c "/usr/bin/ps -o etime= -p 28970"
03:01:40
{code}
 

Furthermore, PpidChecker can actually try to run the command (eg. without pid, 
just to know if it can really execute it) - current fallback mechanism only 
checks if the {{ps}} command is present and executable, but can't detect if the 
command itself fails for whatever reason (here unsupported args)
 
[https://github.com/apache/maven-surefire/blob/master/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java#L80]

I have found there is already some related work in 
[https://github.com/apache/maven-surefire/pull/178], but it doesn't look it 
addresses this at the first sight.

> SurefireBooterForkException: The forked VM terminated without properly saying 
> goodbye since 2.20.1
> --------------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1479
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1479
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.20.1
>            Reporter: Ondrej Lukas
>            Priority: Major
>
> After upgrade to maven surefire plugin to version 2.20.1 (from version 2.20) 
> our testsuite start to fail on HP-UX with:
>  
>  
> {code:java}
> Process Exit Code: 1         at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:496)
>          at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:443)
>          at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:295)
>          at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
>          at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1124)
>          at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)
>          at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:832)
>          at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>          at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
>          at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
>          at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
>          at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
>          at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
>          at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>          at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
>          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)    
>      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)        
>  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)         at 
> org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)         at 
> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)         at 
> org.apache.maven.cli.MavenCli.main(MavenCli.java:194)         at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.lang.reflect.Method.invoke(Method.java:498)         at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>          at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)   
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>          at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
> Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: The 
> forked VM terminated without properly saying goodbye. VM crash or System.exit 
> called?{code}
>  
>  
> This exception is thrown and no test cases are run.
>  
> I believe that this issue in not dependent on HP-UX since I found the same 
> issue for windows [1], but it seems it has not been reported yet.
>  
> Since the only change between correct test execution and thrown exception is 
> just change of surefire version I believe this is regression.
>  
> [1] 
> [https://stackoverflow.com/questions/48631856/maven-surefire-forked-vm-terminated-issue-in-windows]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to