slachiewicz opened a new issue, #48:
URL: https://github.com/apache/maven-executor/issues/48

   `ProcessBuilderExecutorSupport` handles `executionTimeout` with 
`process.destroyForcibly()` on the process it started 
([ProcessBuilderExecutorSupport.java](https://github.com/apache/maven-executor/blob/main/maven-executor/src/main/java/org/apache/maven/executor/support/ProcessBuilderExecutorSupport.java),
 the `else` branch after `await(timeoutMillis, ...)`). That reaches one process:
   
   - On Linux and macOS `bin/mvn` ends in `exec`, so the started process is the 
Maven JVM and it dies; the JVMs Maven forked (Surefire, Failsafe, exec:exec) 
are not touched and keep running.
   - On Windows the started process is `cmd.exe` running `bin/mvn.cmd` 
(`ForkedMavenExecutor` resolves `command() + ".cmd"`); the Maven JVM is its 
child and survives with everything under it.
   
   maven-invoker had the same defect as apache/maven-invoker#135 (MSHARED-867), 
reported on Windows but reproducible everywhere with a Surefire fork that never 
ends; apache/maven-invoker#185 fixes it by destroying 
`ProcessHandle.descendants()` before the parent. maven-executor already has a 
Java 9 layer (`src/main/java9`), so the same can go there without reflection: 
on timeout, 
`process.toHandle().descendants().forEach(ProcessHandle::destroyForcibly)` and 
then `process.destroyForcibly()`; the descendants first, since on Linux they 
are reparented once the parent is gone.
   
   A test that shows it: a project whose Surefire test loops forever and 
appends to a heartbeat file, executed with a timeout; after the 
`ExecutorException` the file must stop growing.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to