EmbeddedMavenExecutor restores a constructor-time System snapshot after every run
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- build-system
Direzione di ricerca
Inizia da maven-executor/src/main/java/org/apache/maven/executor/embedded/EmbeddedMavenExecutor.java alle righe 128-129 e 159-162, quindi segui execute() per capire quando lo stato di System viene acquisito e ripristinato. Il lavoro è completato quando esecuzioni ripetute su un singolo executor di lunga durata preservano le proprietà di sistema impostate tra un'esecuzione e l'altra; aggiungi o aggiorna la copertura per questo comportamento se i test circostanti forniscono una posizione adatta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 5
- Fork
- 2
- Merge medio
- 4h 22m
- PR unite (30g)
- 2
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/maven-executor
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
apache/maven-executor#50 ·
-
enhancement priority:major
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
apache/maven-executor#49 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
apache/maven-executor#48 ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
apache/maven-executor#47 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
apache/maven-executor#45 ·
Tutte le issue di apache/maven-executor
Issue simili
-
area-deployment area-integrations triage:bot-seen
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/flink-agents#1156 ·
-
[source-shopify] FAILED bulk operation without partialDataUrl is silently treated as successful Apertaarea/connectors autoteam community connectors/source/shopify needs-triage team/use type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100