Forked executor leaves the process tree behind on timeout
Maintainers usually reply within 5 days
@slachiewicz is already working on this.
Since Oct 3, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- build-system
Research direction
Start in maven-executor/src/main/java/org/apache/maven/executor/support/ProcessBuilderExecutorSupport.java at the executionTimeout handling, then inspect the Java 9 layer under src/main/java9. Reproduce the issue with a Surefire test that loops and appends to a heartbeat file; done means the heartbeat stops after ExecutorException and the forked processes are terminated.
Written by the indexing model from the issue text.
Description
ProcessBuilderExecutorSupport handles executionTimeout with process.destroyForcibly() on the process it started (ProcessBuilderExecutorSupport.java, the else branch after await(timeoutMillis, ...)). That reaches one process:
- On Linux and macOS
bin/mvnends inexec, 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.exerunningbin/mvn.cmd(ForkedMavenExecutorresolvescommand() + ".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.
- Dominant language
- Java
- Stars
- 5
- Forks
- 4
- Avg merge
- 4d 12m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-executor
-
EmbeddedMavenExecutor restores a constructor-time System snapshot after every runMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
apache/maven-executor#46 ·
Maintainers usually reply within 5 days
-
Forked executor discards the output it grabbed when an execution times outPossibly taken @slachiewicz claimed this 3 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
apache/maven-executor#58 ·
Maintainers usually reply within 5 days
-
Forked executor blocks until caller-supplied stdin reaches EOFMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 68/100
apache/maven-executor#50 ·
Maintainers usually reply within 5 days
-
Roadmap to replace maven-verifier and maven-invokerPossibly taken A pull request linked to this issue is open or already merged. Openenhancement priority:major
Difficulty 5/5 Over a week Newbie friendliness 25/100
apache/maven-executor#49 · 3 comments ·
Maintainers usually reply within 5 days
-
Forked executor closes caller-supplied stdout and stderr streamsMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
apache/maven-executor#45 ·
Maintainers usually reply within 5 days
All issues in apache/maven-executor
Similar issues
-
[Bug] Logo style setting missing and `classic` style not applied across multiple platforms (v3.1.0)Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Stirling-Tools/Stirling-PDF#8382 · 1 reaction ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
Maintainers usually reply within 4 days
-
enhancement untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
opensearch-project/sql#5842 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
openhab/openhab-addons#21882 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
YunaiV/ruoyi-vue-pro#1273 ·
Maintainers usually reply within 3 days