android / android/android-test

Tests failing with StackOverflowError cause a secondary OOM in TestExecutor

Aperta
#285 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
1.2k
Fork
342
Merge medio
11h 29m
PR unite (30g)
2

Descrizione

### Description

### Steps to Reproduce

```java
@Test
public void testWithInfiniteRecursion() {
recurseInfinitely();
}
```

### Expected Results

Test runner reports the StackOverflowError.

### Actual Results

Test runner crashes, because it tries to write the entire stacktrace to the summary writer:

```
Test failed to run to completion. Reason: 'Instrumentation run failed due to 'Process crashed.''. Check device logcat for details
Crash Message:Failed to allocate a 8994568 byte allocation with 462080 free bytes and 451KB until OOM, target footprint 201326592, growth limit 201326592
java.lang.OutOfMemoryError: Failed to allocate a 8994568 byte allocation with 462080 free bytes and 451KB until OOM, target footprint 201326592, growth limit 201326592
at java.lang.StringFactory.newStringFromChars(StringFactory.java:260)
at java.lang.StringFactory.newStringFromBytes(StringFactory.java:245)
at java.lang.StringFactory.newStringFromBytes(StringFactory.java:54)
at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:221)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:68)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:389)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)
```

### AndroidX Test and Android OS Versions

AndroidX Test Runner: 1.1.2-alpha01

### Link to a public git repo demonstrating the problem:

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il malfunzionamento con l'esempio fornito testWithInfiniteRecursion, quindi ispeziona androidx.test.internal.runner.TestExecutor in TestExecutor.java:68, dove lo stacktrace viene scritto nel summary writer. Il lavoro è completato quando il test runner segnala StackOverflowError senza andare in crash con un OutOfMemoryError secondario.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, java
Ambito
mobile, testing
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.