Gradle "Test framework quit unexpectedly" - Fix in CI
By Kaveh Alemi·Latchkey
The forked JVM running your tests died before reporting results. On CI this is usually the OOM killer, a JVM crash, or a native library fault inside the test executor process.
What this error means
The test task fails with Process 'Gradle Test Executor N' finished with non-zero exit value or The forked test process quit unexpectedly, with no individual test failure - the executor itself vanished.
gradle output
> Task :app:test FAILED
> Process 'Gradle Test Executor 3' finished with non-zero exit value 137
This problem might be caused by incorrect test process configuration.
Please refer to the test execution section in the User Manual ...
Common causes
Test JVM OOM-killed
The forked test JVM, plus the daemon and other workers, exceeded the runner RAM and the kernel SIGKILLed the executor (exit 137). No catchable exception is produced.
JVM or native crash in a test
A System.exit() in test code, a JNI/native library fault, or an incompatible agent can hard-crash the executor process mid-run.
How to fix it
Bound the forked test JVM memory
Cap the test JVM heap and limit forks so the executor fits in the runner.
Re-run with --info and inspect the executor exit code; 137 indicates an OOM kill.
Check for System.exit() in test code or a fatal-error log (hs_err_pid*.log) from a JVM crash.
Disable suspect Java agents or native libraries to isolate the fault.
How to prevent it
Cap maxHeapSize and maxParallelForks for the test task, avoid System.exit() in tests, and size the runner to the test JVM footprint.
Frequently asked questions
What causes ""Process 'Gradle Test Executor' ... quit unexpectedly""?
The forked test JVM, plus the daemon and other workers, exceeded the runner RAM and the kernel SIGKILLed the executor (exit 137). No catchable exception is produced.
How do I fix "Process 'Gradle Test Executor' ... quit unexpectedly"?
Cap the test JVM heap and limit forks so the executor fits in the runner.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.