Timeout waiting to lock file hash cache


(roded) #1

Hi,
Up till now, I’ve been successfully running two gradle run tasks concurrently (of different modules in the same multi-module project). However, starting today (as far as I can tell), gradle fails running the 2nd run task due to the following error:

   Timeout waiting to lock file hash cache (X:\@sdks\gradle\caches\3.4.1\fileHashes). It is currently in use by another Gradle instance.
    Owner PID: 2688
    Our PID: 10216
    Owner Operation: 
    Our operation: 
    Lock file: X:\@sdks\gradle\caches\3.4.1\fileHashes\fileHashes.lock

I’m currently using gradle 3.4.1, but the issue remains with older versions of gradle as well.
Also tried running the tasks with --no-daemon as well as emptying gradle’s caches directory, but to no avail.
Mind you, this is not a CI environment with gradle running in different containers or whatnot, this is a simple local gradle installation.
I’m really not sure what has changed (or could have changed) which would cause this. If anyone has any pointers, it would be much appreciated.
Thanks a lot


(roded) #2

What’s happening is that on running the first task, a gradle daemon starts and locks the required file.
For some reason, the daemon does not release the lock all the while the task is running.
On running the 2nd task, another daemon is started (necessarily?) which in turn attempts to acquire a lock on the same file, an attempt which obviously times out.
Is there a known reason for gradle to keep locking the fileHashes? Could this be a build.gradle configuration issue? Or is this more likely a general gradle issue?


(roded) #3

Quite esoteric, but for the sake of some closure:
The issue was that due to a VPN client installed on my computer, the locking gradle task failed receiving the ping requests sent by the waiting gradle task which subsequently timed out.
The issue seems to be on the receiving end as the address returned by InetAddressFactory.getLocalBindingAddress() is 0.0.0.0/0.0.0.0 in both cases (with and without an activated VPN client).