Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.3
-
None
-
Windows XP, JDK 6
-
Patch
Description
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>
Attachments
Attachments
Issue Links
- is duplicated by
-
SUREFIRE-773 surefire forked processes not always killed after timeout
- Closed
- is related to
-
HADOOP-15251 Backport HADOOP-13514 (surefire upgrade) to branch-2
- Resolved
-
SUREFIRE-413 Ctrl-C during tests won't kill forked subprocesses
- Closed