[
http://jira.codehaus.org/browse/SUREFIRE-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jason Zaugg updated SUREFIRE-524:
---------------------------------
Attachment: surefire-2.4.3-remote-shutdown.patch
Added test cases.
Refactored socket code to use NIO.
> 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,
> 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