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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
af2f778
Reproduce OOM with out-of-process worker API
big-guy 3193278
Use a non-decorated fork options when creating fork options for worke…
big-guy d1c8ee6
Add test for legacy worker API as well
big-guy 56e7edf
Fix typo
big-guy e0bb87b
Fix tests
big-guy db0625b
Make sure the memory leak tests for workers use separate daemons
big-guy File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,43 @@ 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 commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. |
||
executer.withBuildJvmOpts('-Xms256m', '-Xmx512m').requireIsolatedDaemons().requireDaemon() | ||
|
||
buildFile << """ | ||
${legacyWorkerTypeAndTask} | ||
|
||
ext.memoryHog = new byte[1024*1024*150] // ~150MB | ||
|
||
tasks.withType(WorkerTask) { task -> | ||
isolationMode = IsolationMode.PROCESS | ||
displayName = "Test Work" | ||
|
||
text = "foo" | ||
arrayOfThings = ["foo", "bar", "baz"] | ||
listOfThings = ["foo", "bar", "baz"] | ||
|
||
// Force a new daemon to be used | ||
workerConfiguration = { | ||
forkOptions { options -> | ||
options.with { | ||
systemProperty("foobar", task.name) | ||
} | ||
} | ||
} | ||
} | ||
task startDaemon1(type: WorkerTask) | ||
task startDaemon2(type: WorkerTask) | ||
task startDaemon3(type: WorkerTask) | ||
""" | ||
|
||
expect: | ||
succeeds("startDaemon1") | ||
succeeds("startDaemon2") | ||
succeeds("startDaemon3") | ||
} | ||
|
||
@Issue("https://github.com/gradle/gradle/issues/10323") | ||
def "can use a Properties object as a parameter"() { | ||
buildFile << """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.