EmbeddedMavenExecutor restores a constructor-time System snapshot after every run
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java
- 领域
- build-system
调研方向
从 maven-executor/src/main/java/org/apache/maven/executor/embedded/EmbeddedMavenExecutor.java 的第 128-129 行和第 159-162 行开始,然后跟踪 execute(),以了解 System 状态何时被捕获和恢复。当在同一个长期存在的 executor 上重复执行时,能够保留两次运行之间设置的系统属性,即表示完成;如果周围的测试提供了合适的位置,请为该行为添加或更新覆盖测试。
由索引模型根据 Issue 内容生成。
描述
Affected version
1.0.0
Bug description
EmbeddedMavenExecutor copies System.getProperties() once, in its constructor (EmbeddedMavenExecutor.java:128-129), together with System.out and System.err, and restores that same snapshot in the finally block of every execute() (:159-162). Any change a caller makes to system properties between two executions on one long-lived executor is silently reverted after the next run. maven-verifier's Embedded3xLauncher snapshotted per run.
The pattern that triggers it is the natural one for a test fixture: one ExecutorHelper per JVM, reused across hundreds of integration tests, some of which set a system property to drive the next build. Found while porting maven-surefire's IT fixture (apache/maven-surefire#3484); the fixture now creates one executor per Verifier instance to avoid it.
Proposal: take the snapshot at the start of each execute() rather than in the constructor. This is distinct from the thread-safety window in #16 item 8, which is about System.setProperties(null) during a run.
The same JVM-lifetime pattern is in apache/maven itself: its/core-it-support/maven-it-helper/.../Verifier.java holds static final EmbeddedMavenExecutor and ForkedMavenExecutor instances, so the core ITs on master and on the 3.x branches (apache/maven-integration-testing#445) are exposed as well; fixing the snapshot point in the executor covers all of them.
The obvious workaround, one EmbeddedMavenExecutor per execution closed afterwards, does not work at scale: on apache/maven-surefire#3484 (run 35594937350) the IT JVM runs out of heap after roughly a hundred builds (java.lang.OutOfMemoryError: Java heap space inside the embedded Maven), because close() does not release the Maven ClassWorld the constructor built. So callers are pushed back to a JVM-lifetime executor and inherit the snapshot behaviour; moving the snapshot into execute() is the fix that avoids both.
- 主要语言
- Java
- 星标
- 5
- 派生
- 2
- 平均合并
- 4 小时 22 分钟
- 30 天内合并 PR
- 2
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/maven-executor 的其他 Issue
-
bug
难度 4/5 3-5 天 新手友好度 68/100
apache/maven-executor#50 ·
-
enhancement priority:major
难度 5/5 一周以上 新手友好度 25/100
apache/maven-executor#49 ·
-
bug
难度 3/5 1-2 天 新手友好度 78/100
apache/maven-executor#48 ·
-
bug
难度 4/5 3-5 天 新手友好度 48/100
apache/maven-executor#47 ·
-
bug
难度 3/5 1-2 天 新手友好度 68/100
apache/maven-executor#45 ·
查看 apache/maven-executor 的全部 Issue
相似的 Issue
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 75/100
apache/flink-agents#1156 ·
-
area/connectors autoteam community connectors/source/shopify needs-triage team/use type/bug
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 85/100