New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent memory leaks across builds when using worker API #10433
Conversation
…r daemon WorkerDaemonClients are retained across builds, so any object associated with it must not contain project state since this will be kept around until the worker expires. - Introduce a newDecoratedJavaForkOptions which creates a decorated JavaForkOptionsInternal - Replace calls to the decorated version of the method with non-decorated versions where appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment about the test, but otherwise LGTM.
@@ -190,6 +190,36 @@ class WorkerExecutorIntegrationTest extends AbstractWorkerExecutorIntegrationTes | |||
assertDifferentDaemonsWereUsed("runInDaemon", "startNewDaemon") | |||
} | |||
|
|||
@Issue("https://github.com/gradle/gradle/issues/10411") | |||
def "does not leak project state across multiple builds"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this wouldn't be better as a soak test and have it run like 20 builds or something. The name of the test bothers me a little bit - it doesn't actually prove that it doesn't leak state - only that you don't get an OOM after 3 builds. I'm not sure that I have a better suggestion, but running more iterations would make me more comfortable with it.
@@ -217,6 +217,41 @@ class WorkerExecutorLegacyApiIntegrationTest extends AbstractIntegrationSpec { | |||
isolationMode << ISOLATION_MODES | |||
} | |||
|
|||
@Issue("https://github.com/gradle/gradle/issues/10411") | |||
def "does not leak project state across multiple builds"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
Fixes #10411
Context
Contributor Checklist
<subproject>/src/integTest
) to verify changes from a user perspective<subproject>/src/test
) to verify logic./gradlew <changed-subproject>:check
Gradle Core Team Checklist