You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jason Zaugg (JIRA)" <ji...@codehaus.org> on 2008/10/12 00:28:50 UTC

[jira] Commented: (SUREFIRE-524) Forked Process not terminated if maven process aborted. Provide means to clean up.

    [ http://jira.codehaus.org/browse/SUREFIRE-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=150585#action_150585 ] 

Jason Zaugg commented on SUREFIRE-524:
--------------------------------------

The patch is against: http://svn.apache.org/repos/asf/maven/surefire/tags/surefire-2.4.3

> Forked Process not terminated if maven process aborted. Provide means to clean up.
> ----------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-524
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-524
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: process forking
>    Affects Versions: 2.4.3
>         Environment: Windows XP, JDK 6
>            Reporter: Jason Zaugg
>            Priority: Minor
>         Attachments: surefire-2.4.3-remote-shutdown.patch
>
>
> Steps to reproduce:
> forkMode = once
> Run a test suite containing: Thread.sleep(Integer.MAX_VALUE)
> Kill maven build
> Observe that surefire JVM still running.
> Use Case:
> 1. Maven build on Contiunous Integration server forks a JVM to run long test suite.
> 2. User aborts the build.
> 3. User expects the test suite to be aborted.
> Workarounds:
> * use forkMode=never
> This is a hassle for us -- at best we have to log in remotely to the build server, find the process and kill it. At worst, we waste time misdiagnosing failures in the subsequently triggered build that are due to concurrent tests executing.
> I'm not sure what the expected behaviour is for maven / surefire currently in this situation. 
> It is likely that is platform dependent. Windows is different from Unix in the way it kills child processes. [1]
> One solution would be to open up a TCP port on the forked JVM to enable a remote shutdown. This would integrate well with the Hudson Port Allocator plugin [2]. At the conclusion of an aborted build, Hudson would clean up the forked surefire JVM. Perhaps surefire itself could register a shutdown hook in the maven JVM which would use attempt a remote shutdown of the forked JVM?
> I've attached a patch to demonstrate the idea. If you would like to include this functionality, I could clean it up and add test cases.
> [1] http://darkforge.blogspot.com/2007/09/windows-killableprocess-and-case-of.html
> [2] http://weblogs.java.net/blog/kohsuke/archive/2007/11/hudson_portallo.html
> <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.4.3.1</version>
>                 <configuration>
>                     <excludes>
>                         <exclude>${integration.test.pattern}</exclude>
>                     </excludes>
>                     <forkMode>once</forkMode>
>                     <remoteShutdownPort>8999</remoteShutdownPort>
>                 </configuration>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira