-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Current Behavior
A large build with configuration cache enabled crashes with OOM, whereas it would complete successfully with Gradle 9.0
Expected Behavior
A large build that completes with 9.0 without errors should do so with Gradle 9.1.0 as well.
Context (optional)
This may be the same as #34691. If a fix for this addresses that bug, that would likely be the case.
We suspect that the current issue was introduced by this: #34019 - the reproducer queries a large number of properties in a large number of projects.
This does not look like a leak - under gradle-profiler, a heap dump taken at the end of the build is quite similar between 9.0 and 9.1. However, with large enough maxProperties
and maxProjects
, 9.1.0 RC1 crashes with OOM with parameters that 9.0 can handle, leaving a heap dump behind.
This histogram is based on a heap dump generated by the JVM for a build crashing due to an OOM.
Self-contained Reproducer Project
// settings.gradle
def maxProjects = System.getProperty("maxProjects", "1").toInteger()
(1..maxProjects).each { n ->
include("project$n")
def projectDir = file("project$n")
projectDir.mkdirs()
project(":project$n").projectDir = file("project$n")
}
// build.gradle
def maxProperties = System.getProperty("maxProperties", "1").toInteger()
subprojects { proj ->
(1..maxProperties).each {
proj.findProperty("property${it}")
}
println("Accessed ${maxProperties} properties from ${proj}")
tasks.register("printInfo") { task ->
def taskPath = task.path
doLast {
println("Running ${taskPath}")
}
}
}
This completes successfully with Gradle 9.0:
gradle help -DmaxProjects=4000 -DmaxProperties=200 --no-daemon --configuration-cache
but fails with an OutOfMemoryError with Gradle 9.1.0 RC1.
Gradle version
9.1.0-rc-1
Gradle version that used to work
9.0.0
Build scan URL (optional)
No response
Your Environment (optional)
No response