Could not create service of type FileHasher using GradleUserHomeScopeServices.createCachingFileHasher()

Here is the context of my problem:

  • a gitlab ci yml pipeline
  • several jobs in the same internship
  • all jobs use a task gradle requiring the use of his cache
  • all jobs share the same gradle cache

My problem:

sometimes, when there are several pipelines at the same time, I get :

What went wrong: Could not create service of type FileHasher using GradleUserHomeScopeServices.createCachingFileHasher().

Timeout waiting to lock file hash cache (/cache/.gradle/caches/5.1/fileHashes). It is currently in use by another Gradle instance. Owner PID: 149 Our PID: 137 Owner Operation: Our operation: Lock file: /cache/myshop/reunion/.gradle/caches/5.1/fileHashes/fileHashes.lock

I can’t find any documentation about the lock system used by gradle. I don’t understand why locks are positioned when the gradle action doesn’t write to cache dir.

Does anyone know how locks work? Or can I simply change the duration of the timeout to allow concomitant tasks to wait their turn long enough before failing?

Translated with DeepL Translate: The world's most accurate translator

I tried to tun gradle without a daemon, did not work.