Hello all, i'm experiencing some gradle contention...
# community-support
r
Hello all, i'm experiencing some gradle contention for a couple of weeks. Using it from Intellij or from terminal. I can't run test, sync, clean or build task multiple time (not in parallele) without having to kill the previous gradle run manually. The second run is stuck and timeout (95% of the time) until I do a killall gradle. I don't understand why this is the case since i've not changed anything in my configuration before experiencing this. For now, i've tried to upgrade the gradle version, now on the 8.13. The IJ version, now on the latest. The macos version now on thaoe... But still stuck. The only things i've notice helping is: _ A reboot, after reboot, i can run gradle tasks normally for a moment before it starts to stuck again n _ Disabling the firewall seems to help the most as i immediatly can run without problems Any idea about what can cause this please ?
v
Maybe use the
gradle-profiler
to see what is happening / hanging?
r
An example i got juste now:
Copy code
It is not possible to use the currently selected Gradle JVM for the operation.
The installation from /Users/romain/Library/Java/JavaVirtualMachines/liberica-23.0.2 will be used instead.
Starting Gradle Daemon...
Gradle Daemon started in 715 ms

FAILURE: Build failed with an exception.

* What went wrong:
Gradle could not start your build.
> Cannot create service of type BuildSessionActionExecutor using method LauncherServices$ToolingBuildSessionScopeServices.createActionExecutor() as there is a problem with parameter #22 of type ValueSnapshotter.
   > Cannot create service of type ValueSnapshotter using method WorkerSharedBuildSessionScopeServices.createValueSnapshotter() as there is a problem with parameter #1 of type List<ValueSnapshotterSerializerRegistry>.
      > Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeServices.createResourceSnapshotterCacheService().
         > Timeout waiting to lock file hash cache (/Users/romain/.gradle/caches/8.10.2/fileHashes). It is currently in use by another Gradle instance.
           Owner PID: 78330
           Our PID: 82413
           Owner Operation: 
           Our operation: 
           Lock file: /Users/romain/.gradle/caches/8.10.2/fileHashes/fileHashes.lock
@Vampire i was not aware of this tool. Thanks. I tried to launch my app in debug mode from IJ (getting stucked and timeout, see the output just before). While stucked i’ve try to run from my terminal
gradle-profiler --benchmark --project-dir ./ dependencies
on the same folder in // This project is in Gradle 8.10.2 I can see it ‘Running warm-up build’ multiple times with each ‘BUILD SUCCESSFUL’
Retried from 2 terminals to see if IJ could be in cause
Copy code
gradle dependencies

Welcome to Gradle 7.6.5!

Here are the highlights of this release:
 - Added support for Java 19.
 - Introduced `--rerun` flag for individual task rerun.
 - Improved dependency block for test suites to be strongly typed.
 - Added a pluggable system for Java toolchains provisioning.

For more details see <https://docs.gradle.org/7.6.5/release-notes.html>

Starting a Gradle Daemon (subsequent builds will be faster)
<-------------> 0% INITIALIZING [1m 30s]
> IDLE
and the
gradle-profiler --benchmark --project-dir ./ dependencies
seems fine
Is there a known port range that are used by the daemon ?
v
Timeout waiting to lock file hash cache
That should just be a symptom. It means there is a Gradle process running that has the file locked. When this happens to me then usually because I'm sitting at some all-threads-suspending breakpoint in the IDE within the Gradle daemon and then trying to launch a second build.
r
Is it possible to get some logs from the daemon ?
v
They are at
<GRADLE_USER_HOME>/daemon/<version>/*.log
r
i only see the log that starting the ‘client’ build the daemon freezes and is blocking all subsequent builds
🤷‍♂️
v
Maybe you should configure the daemon to start with debug port opened and then attach to that daemon when it hangs, maybe you get some information then. Or you just attach to that process to at least get a thread dump.
👀 1