Skip to content
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

Merged
merged 6 commits into from Sep 3, 2019

Conversation

big-guy
Copy link
Member

@big-guy big-guy commented Sep 3, 2019

Fixes #10411

Context

Contributor Checklist

  • Review Contribution Guidelines
  • Make sure that all commits are signed off to indicate that you agree to the terms of Developer Certificate of Origin.
  • Check "Allow edit from maintainers" option in pull request so that additional changes can be pushed by Gradle team
  • Provide integration tests (under <subproject>/src/integTest) to verify changes from a user perspective
  • Provide unit tests (under <subproject>/src/test) to verify logic
  • Update User Guide, DSL Reference, and Javadoc for public-facing changes
  • Ensure that tests pass locally: ./gradlew <changed-subproject>:check

Gradle Core Team Checklist

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation
  • Recognize contributor in release notes

…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
@big-guy big-guy changed the base branch from master to release September 3, 2019 13:41
Copy link
Member

@ghale ghale left a 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"() {
Copy link
Member

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"() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

@big-guy big-guy added this to the 5.6.2 milestone Sep 3, 2019
@big-guy big-guy merged commit cfc81e4 into release Sep 3, 2019
@big-guy big-guy deleted the sg/regressions/memory-leak branch September 12, 2019 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants