gradle / gradle-profiler

A tool for gathering profiling and benchmarking information for Gradle builds
Apache License 2.0
1.41k stars 156 forks source link

Daemon might keep files open on user home cleanup #575

Open asodja opened 2 months ago

asodja commented 2 months ago

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: https://github.com/gradle/gradle-profiler/blob/f6044956fceffbca95bd81e133d29c6e1b5aee05/src/test/groovy/org/gradle/profiler/ProfilerIntegrationTest.groovy#L1587-L1617

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

lptr commented 2 months ago

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.