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

Daemon might keep files open on user home cleanup #575

Open
asodja opened this issue Sep 5, 2024 · 1 comment
Open

Daemon might keep files open on user home cleanup #575

asodja opened this issue Sep 5, 2024 · 1 comment
Labels

Comments

@asodja
Copy link
Member

asodja commented Sep 5, 2024

See discussion:
https://gradle.slack.com/archives/C0WTFHWT1/p1725541056983899

org.gradle.profiler.ProfilerIntegrationTest tests can fail with:

org.gradle.profiler.Main$ScenarioFailedException: java.lang.IllegalStateException: Could not delete C:\tcagent1\temp\buildTmp\junit8579535606657717703\junit1504971569986759376\gradle-user-home\native

This might indicate that even though we require no-daemon for user home cleanup, daemon is kept around and locks files.

Test:

def "clean Gradle user home cache when configured"() {
given:
buildFile << """
plugins {
id 'java'
}
"""
file("src/main/java").mkdirs()
file("src/main/java/Main.java") << """
public class Main {
public static void main(String... args) {
System.out.println("Hello, World!");
}
}
"""
def scenarios = file("performance.scenario")
scenarios.text = """
buildTarget {
versions = ["${latestSupportedGradleVersion}"]
clear-gradle-user-home-before = BUILD
daemon = none
tasks = ["compileJava"]
}
"""
when:
benchmarkScenario(scenarios)
then:
output.count("> Cleaning Gradle user home: ") == 2
}

Build scan:
https://ge.gradle.org/s/zbhfyalegpj3w/tests/task/:test/details/org.gradle.profiler.ProfilerIntegrationTest/clean%20Gradle%20user%20home%20cache%20when%20configured?top-execution=1

@asodja asodja added the bug label Sep 5, 2024
@lptr
Copy link
Member

lptr commented Sep 5, 2024

Since the test is flaky, it looks like the daemon is shutting down, we just don't wait long enough for it to finish.

Let's add some logic to await daemon shutdown.

Doing so would have the added benefit of eliminating the impact of a shutting down daemon from a previous iteration when measuring a build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants